feat(release): enhance changelog commit process with PR creation for … #54
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*] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Version to release (e.g., v1.2.3) | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| packages: write | |
| pull-requests: write | |
| env: | |
| WAIT_INTERVAL_SECONDS: 30 | |
| jobs: | |
| validate: | |
| name: Validate | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| is_prerelease: ${{ steps.version.outputs.is_prerelease }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine Version | |
| id: version | |
| run: ./.github/scripts/release.sh determine-version "${{ github.event_name }}" | |
| "${{ github.event.inputs.version }}" | |
| wait: | |
| name: Wait for Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Wait for tests workflow to complete before creating release | |
| # Note: This step requires GitHub API access and won't work with act (local testing) | |
| # It will fail gracefully in act, allowing manual testing of release steps | |
| - name: Wait | |
| uses: lewagon/wait-on-check-action@3603e826ee561ea102b58accb5ea55a1a7482343 # v1.4.1 | |
| continue-on-error: true | |
| with: | |
| ref: ${{ github.sha }} | |
| check-name: Run All Tests | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| wait-interval: ${{ env.WAIT_INTERVAL_SECONDS }} | |
| allowed-conclusions: success | |
| create: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [validate, wait] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure Git | |
| run: ./.github/scripts/release.sh configure-git | |
| - name: Determine Version and Branch | |
| id: setup | |
| run: ./.github/scripts/release.sh determine-version-and-branch "${{ needs.validate.outputs.version }}" | |
| - name: Bump Changelog Version (Fixed) | |
| if: steps.setup.outputs.is_fixed_version == 'true' | |
| id: bump_fixed | |
| run: ./.github/scripts/release.sh bump-changelog-fixed "${{ steps.setup.outputs.version_no_v }}" | |
| "CHANGELOG.md" "true" | |
| - name: Bump Changelog Version (Keyword) | |
| if: steps.setup.outputs.is_fixed_version != 'true' | |
| id: bump | |
| uses: release-flow/keep-a-changelog-action@74931dec7ecdbfc8e38ac9ae7e8dd84c08db2f32 # v3 | |
| with: | |
| command: bump | |
| version: ${{ steps.setup.outputs.version_no_v }} | |
| changelog: CHANGELOG.md | |
| tag-prefix: v | |
| keep-unreleased-section: true | |
| - name: Commit Updated Changelog | |
| continue-on-error: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| run: ./.github/scripts/release.sh commit-changelog "${{ needs.validate.outputs.version }}" | |
| "${{ steps.setup.outputs.branch }}" | |
| - name: Query Release Notes | |
| id: query | |
| uses: release-flow/keep-a-changelog-action@74931dec7ecdbfc8e38ac9ae7e8dd84c08db2f32 # v3 | |
| with: | |
| command: query | |
| version: ${{ steps.setup.outputs.version_no_v }} | |
| changelog: CHANGELOG.md | |
| # Create GitHub release (requires GitHub API) | |
| # Note: This step requires GitHub API access and won't work with act (local testing) | |
| # It will fail gracefully in act, allowing manual testing of changelog steps | |
| - name: Create Release | |
| uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2 | |
| continue-on-error: true | |
| with: | |
| tag_name: ${{ needs.validate.outputs.version }} | |
| name: Release ${{ needs.validate.outputs.version }} | |
| body: ${{ steps.query.outputs.release-notes }} | |
| prerelease: ${{ needs.validate.outputs.is_prerelease == 'true' }} | |
| make_latest: ${{ needs.validate.outputs.is_prerelease == 'false' }} | |
| # Create Sentry release for error tracking and deployment monitoring | |
| # Uses getsentry/action-release@v3 to create a release in Sentry | |
| # Docs: https://github.com/getsentry/action-release | |
| # | |
| # Purpose: Track releases in Sentry for: | |
| # - Determining issues and regressions introduced in new releases | |
| # - Predicting which commit caused an issue and who is responsible | |
| # - Resolving issues by including issue number in commit messages | |
| # - Receiving email notifications when code gets deployed | |
| # | |
| # Features used: | |
| # - Automatic commit range detection (set_commits: auto) | |
| # - Production environment deployment tracking | |
| # - Release version matches GitHub release tag | |
| # - Automatic commit attribution and issue resolution | |
| # | |
| # Prerequisites: | |
| # - SENTRY_AUTH_TOKEN: Authentication token (from Sentry Internal Integration) | |
| # - SENTRY_ORG: Organization slug in Sentry | |
| # - SENTRY_PROJECT: Project slug in Sentry (optional if using projects input) | |
| # | |
| # The release version uses the validated version from the validate job, | |
| # which matches the tag_name used in the GitHub release and the version | |
| # configured in the Sentry SDK (via get_version()). | |
| # | |
| # Note: This step requires Sentry API access and won't work with act (local testing) | |
| # It will fail gracefully in act, allowing manual testing of other release steps | |
| - name: Create Sentry Release | |
| if: needs.validate.outputs.is_prerelease != 'true' | |
| uses: getsentry/action-release@128c5058bbbe93c8e02147fe0a9c713f166259a6 # v3 | |
| continue-on-error: true | |
| env: | |
| # Required: Sentry authentication token from Internal Integration | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| # Required: Organization slug in Sentry | |
| SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
| # Required: Project slug in Sentry | |
| SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
| # Optional: Sentry URL (only needed for self-hosted Sentry) | |
| # SENTRY_URL: https://sentry.io/ | |
| with: | |
| # Set environment to production for deployment tracking | |
| environment: production | |
| # Release version matches GitHub release tag and Sentry SDK release | |
| # Strips 'refs/tags/' prefix automatically if present | |
| release: ${{ needs.validate.outputs.version }} | |
| # Automatically set commits from git history (finds previous release) | |
| set_commits: auto | |
| # Mark release as finalized (ready for production) | |
| finalize: true | |
| # Don't fail if previous release commit not found (first release) | |
| ignore_missing: true |