Release v1.4.8 #27
This file contains hidden or 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
| name: Version Bump | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| jobs: | |
| bump: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Determine bump type from PR labels | |
| id: bump-type | |
| env: | |
| PR_LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} | |
| run: | | |
| if echo "$PR_LABELS" | grep -q "release:major"; then | |
| echo "type=major" >> $GITHUB_OUTPUT | |
| elif echo "$PR_LABELS" | grep -q "release:minor"; then | |
| echo "type=minor" >> $GITHUB_OUTPUT | |
| elif echo "$PR_LABELS" | grep -q "release:patch"; then | |
| echo "type=patch" >> $GITHUB_OUTPUT | |
| else | |
| echo "type=none" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Checkout main | |
| if: steps.bump-type.outputs.type != 'none' | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| token: ${{ secrets.RELEASE_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| if: steps.bump-type.outputs.type != 'none' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Bump version and commit | |
| if: steps.bump-type.outputs.type != 'none' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| npm version ${{ steps.bump-type.outputs.type }} --no-git-tag-version | |
| NEW_VERSION=$(jq -r .version package.json) | |
| git add package.json package-lock.json | |
| git commit -m "chore: bump version to v${NEW_VERSION}" | |
| git push origin main | |
| - name: Sync version bump to dev | |
| if: steps.bump-type.outputs.type != 'none' | |
| run: | | |
| NEW_VERSION=$(jq -r .version package.json) | |
| git fetch origin dev | |
| git checkout dev | |
| git merge origin/main --no-ff -m "chore: sync version bump v${NEW_VERSION} from main" | |
| git push origin dev |