bump version #11
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write # for OIDC | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24.x | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run lint | |
| - name: Read package version | |
| id: pkg | |
| shell: bash | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Check existing tag | |
| id: tag_check | |
| uses: actions/github-script@v7 | |
| env: | |
| TAG_NAME: ${{ steps.pkg.outputs.tag }} | |
| with: | |
| script: | | |
| const tag = process.env.TAG_NAME; | |
| try { | |
| await github.rest.git.getRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: `tags/${tag}` | |
| }); | |
| core.setOutput("exists", "true"); | |
| } catch (error) { | |
| if (error.status === 404) { | |
| core.setOutput("exists", "false"); | |
| } else { | |
| throw error; | |
| } | |
| } | |
| - name: Create GitHub release | |
| if: steps.tag_check.outputs.exists == 'false' | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.pkg.outputs.tag }} | |
| release_name: ${{ steps.pkg.outputs.tag }} | |
| body: "Automated release for ${{ steps.pkg.outputs.tag }}." | |
| - name: Configure npmjs registry | |
| if: steps.tag_check.outputs.exists == 'false' | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24.x | |
| registry-url: https://registry.npmjs.org | |
| - name: Publish to npm (npmjs.org) | |
| if: steps.tag_check.outputs.exists == 'false' | |
| run: npm publish --provenance --access public |