Bump version to 2.0.0 #13
Workflow file for this run
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: Publish | |
| on: | |
| pull_request: | |
| types: | |
| - closed | |
| jobs: | |
| compare: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| outputs: | |
| base_version: ${{ steps.base.outputs.version }} | |
| current_version: ${{ steps.current.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.event.pull_request.base.sha }} | |
| - id: base | |
| run: echo "version=$(jq -r .version < package.json)" >> "$GITHUB_OUTPUT" | |
| - uses: actions/checkout@v3 | |
| - id: current | |
| run: echo "version=$(jq -r .version < package.json)" >> "$GITHUB_OUTPUT" | |
| publish: | |
| needs: compare | |
| if: needs.compare.outputs.base_version != needs.compare.outputs.current_version | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| discussions: write | |
| id-token: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22 | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Tag | |
| run: | | |
| git tag v$(jq -r .version < package.json) | |
| git push origin v$(jq -r .version < package.json) | |
| gh pr comment ${{ github.event.number }} --body "Created tag [v$(jq -r .version < package.json)](https://github.com/${{ github.repository }}/releases/tag/v$(jq -r .version < package.json))." | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Publish to NPM | |
| run: | | |
| npm ci | |
| npm publish --provenance --tag $(if [[ $(jq .version < package.json) =~ [0-9]+\.[0-9]+\.[0-9]+\-([^\.]+) ]]; then echo ${BASH_REMATCH[1]}; else echo "latest"; fi) --access public | |
| gh pr comment ${{ github.event.number }} --body "🎉 Successfully published version [$(jq -r .version < package.json)](https://www.npmjs.com/package/$(jq -r .name < package.json)/v/$(jq -r .version < package.json)) to NPM! | |
| Install this version: \`npm i $(jq -r .name < package.json)@$(if [[ $(jq .version < package.json) =~ [0-9]+\.[0-9]+\.[0-9]+\-([^\.]+) ]]; then echo ${BASH_REMATCH[1]}; else echo "latest"; fi)\`" | |
| shell: bash | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| GH_TOKEN: ${{ github.token }} |