From 6b4b3b9508492d634bcfec968a3bc4934a76f365 Mon Sep 17 00:00:00 2001 From: asyncapi-bot Date: Tue, 12 Nov 2024 13:20:35 +0100 Subject: [PATCH] ci: update of files from global .github repo (#865) --- .github/workflows/if-nodejs-pr-testing.yml | 47 ++++++++++--------- .../workflows/update-maintainers-trigger.yaml | 28 +++++++++++ .releaserc | 24 ++++++++++ 3 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/update-maintainers-trigger.yaml create mode 100644 .releaserc diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index ad7b99359..462e61316 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -46,31 +46,36 @@ jobs: name: Checkout repository uses: actions/checkout@v4 - if: steps.should_run.outputs.shouldrun == 'true' + name: Check if Node.js project and has package.json + id: packagejson + run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT + shell: bash + - if: steps.packagejson.outputs.exists == 'true' + name: Check package-lock version + uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master + id: lockversion + - if: steps.packagejson.outputs.exists == 'true' name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 - - if: steps.should_run.outputs.shouldrun == 'true' - uses: pnpm/action-setup@v3 - with: - run_install: false - - if: steps.should_run.outputs.shouldrun == 'true' - name: Get pnpm store directory + node-version: "${{ steps.lockversion.outputs.version }}" + - if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest' + #npm cli 10 is buggy because of some cache issue + name: Install npm cli 8 shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - if: steps.should_run.outputs.shouldrun == 'true' - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - if: steps.should_run.outputs.shouldrun == 'true' + run: npm install -g npm@8.19.4 + - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies shell: bash - run: pnpm install - - if: steps.should_run.outputs.shouldrun == 'true' + run: npm ci + - if: steps.packagejson.outputs.exists == 'true' name: Test - run: pnpm test + run: npm test --if-present + - if: steps.packagejson.outputs.exists == 'true' && matrix.os == 'ubuntu-latest' + #linting should run just one and not on all possible operating systems + name: Run linter + run: npm run lint --if-present + - if: steps.packagejson.outputs.exists == 'true' + name: Run release assets generation to make sure PR does not break it + shell: bash + run: npm run generate:assets --if-present diff --git a/.github/workflows/update-maintainers-trigger.yaml b/.github/workflows/update-maintainers-trigger.yaml new file mode 100644 index 000000000..12fc4abe4 --- /dev/null +++ b/.github/workflows/update-maintainers-trigger.yaml @@ -0,0 +1,28 @@ +# This action is centrally managed in https://github.com/asyncapi/.github/ +# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo + +name: Trigger MAINTAINERS.yaml file update + +on: + push: + branches: [ master ] + paths: + # Check all valid CODEOWNERS locations: + # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-file-location + - 'CODEOWNERS' + - '.github/CODEOWNERS' + - '.docs/CODEOWNERS' + +jobs: + trigger-maintainers-update: + name: Trigger updating MAINTAINERS.yaml because of CODEOWNERS change + runs-on: ubuntu-latest + + steps: + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # https://github.com/peter-evans/repository-dispatch/releases/tag/v3.0.0 + with: + # The PAT with the 'public_repo' scope is required + token: ${{ secrets.GH_TOKEN }} + repository: ${{ github.repository_owner }}/community + event-type: trigger-maintainers-update diff --git a/.releaserc b/.releaserc new file mode 100644 index 000000000..1ac05cb15 --- /dev/null +++ b/.releaserc @@ -0,0 +1,24 @@ +--- +branches: +- master +# by default release workflow reacts on push not only to master. +#This is why out of the box sematic release is configured for all these branches +- name: next-spec + prerelease: true +- name: next-major + prerelease: true +- name: next-major-spec + prerelease: true +- name: beta + prerelease: true +- name: alpha + prerelease: true +- name: next + prerelease: true +plugins: +- - "@semantic-release/commit-analyzer" + - preset: conventionalcommits +- - "@semantic-release/release-notes-generator" + - preset: conventionalcommits +- "@semantic-release/npm" +- "@semantic-release/github"