chore(release): publish 0.3.2 #17
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| cache: npm | |
| - run: npm ci | |
| - run: npm test | |
| - name: Derive release metadata | |
| id: meta | |
| shell: bash | |
| run: | | |
| version="${GITHUB_REF_NAME#v}" | |
| if [[ "$version" == *-* ]]; then | |
| echo "Only stable release tags are supported: $version" >&2 | |
| exit 1 | |
| fi | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Ensure tag matches package version | |
| shell: bash | |
| run: | | |
| package_version=$(node -p "JSON.parse(require('node:fs').readFileSync('package.json', 'utf8')).version") | |
| if [[ "$package_version" != "${{ steps.meta.outputs.version }}" ]]; then | |
| echo "Tag version ${{ steps.meta.outputs.version }} does not match package.json version $package_version" >&2 | |
| exit 1 | |
| fi | |
| - run: npm publish --access public --tag latest | |
| - name: Create GitHub release | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then | |
| echo "GitHub release for $GITHUB_REF_NAME already exists." | |
| exit 0 | |
| fi | |
| gh release create "$GITHUB_REF_NAME" --verify-tag --generate-notes |