ci: add stable release creation workflow #78
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
mupen64/ugui!78
Loading…
Reference in a new issue
No description provided.
Delete branch "stable-release-ci"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request overview
Adds a manually triggered GitHub Actions workflow to create draft “stable” releases from the latest main build artifact, with an auto-generated changelog.
Changes:
.github/workflows/release.ymlworkflow_dispatch pipeline that checks outmain, downloads the latestbuildartifact, and drafts a GitHub Release.git-cliffbased on the previous stable release tag.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -0,0 +25,4 @@- name: Guard against non-main branchesrun: |if [[ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]]; thenThe branch guard is likely to fail because
actions/checkouttypically leaves the repo in a detached HEAD state (sogit rev-parse --abbrev-ref HEADreturnsHEAD, notmain). Consider enforcing main via a job/stepif: github.ref_name == 'main'check, or compare the checked-out commit toorigin/main, or explicitly create a localmainbranch after checkout instead of relying on--abbrev-ref.@ -0,0 +35,4 @@with:github_token: ${{ secrets.GITHUB_TOKEN }}workflow: main.ymlbranch: mainThis workflow checks out
mainat run time but downloads the artifact from the latestmain.ymlrun, which can be for a different commit than the one just checked out (e.g., if a newer commit was pushed but its build is still running/failed). That can produce releases where the changelog/tag and attached artifacts don't correspond to the same SHA. Consider pinning the artifact download to the same commit you intend to release (or obtaining the run-id/SHA of the build you download and checking out that SHA).@ -0,0 +44,4 @@env:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}run: |tag=$(gh release list --exclude-pre-releases --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null || true)When there are no stable releases, the jq expression
'.[0].tagName'will evaluate tonull, which is non-empty and will make the next step rungit cliffwith anull..HEADrange. Treatnullthe same as empty (or change the jq filter to return an empty string when the array is empty) before deciding whichgit cliffcommand to run.@ -0,0 +65,4 @@{echo 'body<<EOF'cat CHANGELOG_DRAFT.mdecho EOFWriting the changelog into
$GITHUB_OUTPUTuses a fixedEOFdelimiter. If the generated changelog ever contains a line that equals the delimiter, it will corrupt the output value. Use a unique delimiter (e.g., randomly generated) to make the output robust.