Repository navigation
chore(release): draft the release with the patch record when a vX.Y.Z tag is pushed #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Draft release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v[0-9]+.[0-9]+.[0-9]+" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| on-production: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Tagged commit must be on production | ||
| run: | | ||
| git fetch --no-tags origin production | ||
| if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/production; then | ||
| echo "::error::tag $GITHUB_REF_NAME points to a commit that is not on production" | ||
| exit 1 | ||
| fi | ||
|
|
||
| test: | ||
| needs: on-production | ||
| uses: ./.github/workflows/pull_request_unit_tests.yml | ||
| secrets: inherit | ||
|
|
||
| draft: | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Create draft release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| sed "s/vX\.Y\.Z/${GITHUB_REF_NAME}/g" .github/RELEASE_NOTES_TEMPLATE.md > "$RUNNER_TEMP/notes.md" | ||
| gh release create "$GITHUB_REF_NAME" \ | ||
| --verify-tag --draft --generate-notes \ | ||
| --notes-file "$RUNNER_TEMP/notes.md" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pin the release commit when the draft creates the tag.
The command creates the draft without
--target. WhenvX.Y.Zdoes not exist, GitHub creates the tag from the default branch at publication, not at draft creation. If the default branch advances between those steps, the published tag can point to a newer commit than the one the generated notes describe. The template also lacks a step that creates the tag beforehand.Create and push the tag at the intended release commit before the draft step, or pass that commit with
--target. Either approach fixes the target commit.