From ec68596ca22ea029533d820a7bc02ac5c7ecedc3 Mon Sep 17 00:00:00 2001 From: icealtria <74185220+icealtria@users.noreply.github.com> Date: Wed, 27 Mar 2024 18:17:03 +0800 Subject: [PATCH] CI: Bump Version --- .github/workflows/version.yml | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/version.yml diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 0000000..8daf0dd --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,54 @@ +name: Bump Version +on: + workflow_dispatch: + inputs: + type: + description: 'Type of version (`major`, `minor`, `patch`)' + required: true + default: 'patch' + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + token: ${{secrets.PAT}} # use a personal acces token so that other actions can trigger + # Bump the version number + - name: Update Version + uses: MCKanpolat/auto-semver-action@v2 + id: version + with: + releaseType: ${{ github.event.inputs.type }} + github_token: ${{ secrets.PAT }} + # update the manifest.json with the new version + - name: Update manifest version + uses: jossef/action-set-json-field@v2.1 + with: + file: manifest.json + field: version + value: ${{ steps.version.outputs.version }} + # update the package.json with the new version + - name: Update package version + uses: jossef/action-set-json-field@v2.1 + with: + file: package.json + field: version + value: ${{ steps.version.outputs.version }} + # update the versions.json with the new version + - name: Commit manifest + run: | + git config --local user.name "GitHub Action" + git config --local user.email "action@github.com" + git branch --show-current + git add -u + git commit -m "${{ steps.version.outputs.version }}" + git tag -fa ${{ steps.version.outputs.version }} -m "${{ steps.version.outputs.version }}" + # push the commit + - name: Push changes + uses: ad-m/github-push-action@master + with: + tags: true + force: true \ No newline at end of file