Release v4.0.2 #11
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: Prepare Release | |
| on: | |
| pull_request_review: | |
| types: | |
| - submitted | |
| branches: | |
| - main | |
| jobs: | |
| prepare: | |
| if: | | |
| github.event.pull_request.head.ref != null && | |
| startsWith(github.event.pull_request.head.ref, 'release/v') && | |
| github.event.review.state == 'approved' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| checks: read | |
| steps: | |
| - name: Extract version from branch name | |
| id: version | |
| run: | | |
| BRANCH="${{ github.event.pull_request.head.ref }}" | |
| # Extract version from release/vX.Y.Z or release/vX.Y.Z-prerelease | |
| VERSION="${BRANCH#release/v}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=v$VERSION" >> $GITHUB_OUTPUT | |
| echo "📦 Detected version: $VERSION" | |
| echo "🏷️ Tag: v$VERSION" | |
| - name: Post release prompt comment | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const version = '${{ steps.version.outputs.version }}'; | |
| const tag = '${{ steps.version.outputs.tag }}'; | |
| // Check if we've already posted this comment | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const releasePromptExists = comments.some(comment => | |
| comment.body.includes('🚀 Ready to release') && | |
| comment.user.type === 'Bot' | |
| ); | |
| if (releasePromptExists) { | |
| console.log('ℹ️ Release prompt comment already exists'); | |
| return; | |
| } | |
| // Post the release prompt | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: `🚀 **Ready to Release** | |
| The PR is approved! The version is ready to be released. | |
| **To proceed with the release:** | |
| 1. Review the version: \`${tag}\` | |
| 2. Verify that CI has passed (check the PR status checks below) | |
| 3. Comment **/release** on this PR to trigger the release process | |
| 4. The release workflow will verify merge permissions, then: | |
| - Create a GitHub release with tag \`${tag}\` | |
| - Build production artifacts | |
| - Upload assets to the release | |
| - Publish to npmjs.org | |
| - Automatically merge this PR`, | |
| }); | |
| console.log('✅ Posted release prompt comment'); | |