Release: Tag #1
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
| # Tags the version on the main branch commit where the release was cut from. | |
| # Run this from the release/v* branch after the GitHub release is created. | |
| # This ensures release-please can correctly identify new commits in the next release. | |
| name: "Release: Tag" | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| tag: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Validate branch | |
| run: | | |
| if [[ ! "${{ github.ref_name }}" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Error: Must run from a release/v* branch (e.g., release/v0.3.0)" | |
| exit 1 | |
| fi | |
| - name: Extract version | |
| id: version | |
| run: | | |
| VERSION="${{ github.ref_name }}" | |
| VERSION="${VERSION#release/}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Tagging version: $VERSION" | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 0 | |
| - name: Tag version on main cut point | |
| run: | | |
| git fetch origin main | |
| CUT_SHA=$(git merge-base origin/main HEAD) | |
| echo "Release was cut from main at: $CUT_SHA" | |
| git tag -f "${{ steps.version.outputs.version }}" "$CUT_SHA" | |
| git push origin "${{ steps.version.outputs.version }}" --force | |
| echo "Tagged ${{ steps.version.outputs.version }} at $CUT_SHA" |