diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index 68daa7c0..0dbe805c 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -1,7 +1,7 @@ # 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 -# Purpose of this action is to update npm package in libraries that use it. It is like dependabot for asyncapi npm modules only. +# Purpose of this action is to update npm package in libraries that use it. It is like dependabot for asyncapi npm modules only. # It runs in a repo after merge of release commit and searches for other packages that use released package. Every found package gets updated with lates version name: Bump package version in dependent repos - if Node project @@ -12,6 +12,11 @@ on: push: branches: - master + workflow_dispatch: # Add this section to enable manual triggering + inputs: + trigger-bot-workflow: + description: 'Trigger the bot workflow manually' + required: false jobs: bump-in-dependent-projects: @@ -20,13 +25,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Check if Node.js project and has package.json id: packagejson - run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" + run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT - if: steps.packagejson.outputs.exists == 'true' name: Bumping latest version of this package in other repositories - uses: derberg/npm-dependency-manager-for-your-github-org@v4 + uses: derberg/npm-dependency-manager-for-your-github-org@26a4f13d740254719971325046822a169aaa7441 # using v5.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v5.0.0 with: github_token: ${{ secrets.GH_TOKEN }} committer_username: asyncapi-bot diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml index 73bffb04..db828d84 100644 --- a/.github/workflows/if-nodejs-release.yml +++ b/.github/workflows/if-nodejs-release.yml @@ -15,6 +15,11 @@ on: - next-major-spec - beta - alpha + workflow_dispatch: # Add this section to enable manual triggering + inputs: + trigger-bot-workflow: + description: 'Trigger the bot workflow manually' + required: false jobs: @@ -39,14 +44,14 @@ jobs: git config --global core.autocrlf false git config --global core.eol lf - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Check if Node.js project and has package.json id: packagejson - run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" + run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT shell: bash - if: steps.packagejson.outputs.exists == 'true' name: Setup Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 14 cache: 'npm' @@ -77,13 +82,13 @@ jobs: git config --global core.autocrlf false git config --global core.eol lf - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Check if Node.js project and has package.json id: packagejson - run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" + run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT - if: steps.packagejson.outputs.exists == 'true' name: Setup Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: 14 - if: steps.packagejson.outputs.exists == 'true' @@ -110,4 +115,4 @@ jobs: fields: repo,action,workflow text: 'Release workflow failed in release job' env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} \ No newline at end of file + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} diff --git a/.github/workflows/if-nodejs-version-bump.yml b/.github/workflows/if-nodejs-version-bump.yml index 721caa9d..d5c7add8 100644 --- a/.github/workflows/if-nodejs-version-bump.yml +++ b/.github/workflows/if-nodejs-version-bump.yml @@ -4,10 +4,15 @@ # It does magic only if there is package.json file in the root of the project name: Version bump - if Node.js project -on: +on: release: - types: + types: - published + workflow_dispatch: # Add this section to enable manual triggering + inputs: + trigger-bot-workflow: + description: 'Trigger the bot workflow manually' + required: false jobs: version_bump: @@ -15,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: # target branch of release. More info https://docs.github.com/en/rest/reference/repos#releases # in case release is created from release branch then we need to checkout from given branch @@ -23,14 +28,14 @@ jobs: ref: ${{ github.event.release.target_commitish }} - name: Check if Node.js project and has package.json id: packagejson - run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" + run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies run: npm install - if: steps.packagejson.outputs.exists == 'true' name: Assets generation run: npm run generate:assets - - if: steps.packagejson.outputs.exists == 'true' + - if: steps.packagejson.outputs.exists == 'true' name: Bump version in package.json # There is no need to substract "v" from the tag as version script handles it # When adding "bump:version" script in package.json, make sure no tags are added by default (--no-git-tag-version) as they are already added by release workflow @@ -38,7 +43,7 @@ jobs: run: VERSION=${{github.event.release.tag_name}} npm run bump:version - if: steps.packagejson.outputs.exists == 'true' name: Create Pull Request with updated asset files including package.json - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # use 4.2.4 https://github.com/peter-evans/create-pull-request/releases/tag/v4.2.4 with: token: ${{ secrets.GH_TOKEN }} commit-message: 'chore(release): ${{github.event.release.tag_name}}' @@ -46,4 +51,4 @@ jobs: author: asyncapi-bot title: 'chore(release): ${{github.event.release.tag_name}}' body: 'Version bump in package.json for release [${{github.event.release.tag_name}}](${{github.event.release.html_url}})' - branch: version-bump/${{github.event.release.tag_name}} \ No newline at end of file + branch: version-bump/${{github.event.release.tag_name}}