bump: version 0.2.2 → 0.2.3 #5
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: Bump version, release, and publish | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| bump-version: | |
| if: "!startsWith(github.event.head_commit.message, 'bump:')" | |
| runs-on: ubuntu-latest | |
| name: "Bump version and create changelog with commitizen" | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| with: | |
| token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install Dependencies | |
| run: npm i | |
| - name: Build | |
| run: npm run build | |
| - name: Get current version from package.json | |
| id: get_current_version | |
| run: | | |
| PREVIOUS_VERSION=$(jq -r .version package.json) | |
| echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_ENV | |
| - name: Create bump and changelog | |
| uses: commitizen-tools/commitizen-action@master | |
| with: | |
| github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| changelog_increment_filename: body.md | |
| - name: Create GH Release | |
| if: env.REVISION != env.PREVIOUS_VERSION | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| body_path: "body.md" | |
| tag_name: ${{ env.REVISION }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Authenticate with npm | |
| if: env.REVISION != env.PREVIOUS_VERSION | |
| run: npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} | |
| - name: Publish to npm | |
| if: env.REVISION != env.PREVIOUS_VERSION | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| npm publish --access public |