Merge branch 'staging' #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: Release | |
| # When the root package.json version is bumped and merged to main, tag the | |
| # commit vX.Y.Z and publish a GitHub Release with auto-generated notes. | |
| # Bumping the version is a deliberate PR change; publishing is automatic. | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths: | |
| - 'package.json' | |
| - '.github/workflows/release.yml' | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Read version from package.json | |
| id: version | |
| run: echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT" | |
| - name: Check whether this release already exists | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| if gh release view "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| echo "v${{ steps.version.outputs.version }} already released — nothing to do." | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create tag and GitHub Release | |
| if: steps.check.outputs.exists == 'false' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "v${{ steps.version.outputs.version }}" \ | |
| --target "${{ github.sha }}" \ | |
| --title "v${{ steps.version.outputs.version }}" \ | |
| --generate-notes |