forked from asyncapi/simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1aa972a
commit 0546494
Showing
3 changed files
with
33 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,46 +4,51 @@ | |
# 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: | ||
name: Generate assets and bump NodeJS | ||
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 | ||
# if @semantic-release/github is used to publish, the minimum version is 7.2.0 for proper working | ||
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 | ||
# When adding "bump:version" script in package.json, make sure --allow-same-version is set in case someone forgot and updated package.json manually and we want to avoide this action to fail and raise confusion | ||
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}}' | ||
committer: asyncapi-bot <[email protected]> | ||
author: asyncapi-bot <[email protected]> | ||
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}} | ||
branch: version-bump/${{github.event.release.tag_name}} |