ci(release): fix the Release workflow and attach the release files automatically #1044
Closed
hckrman101 wants to merge 1 commit from
ci-automated-release into main
pull from: ci-automated-release
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1044
Loading…
Reference in a new issue
No description provided.
Delete branch "ci-automated-release"
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?
What was broken
The Release workflow has failed on every push to main that had something to release.
.releaserc.jsonuses theconventionalcommitspreset, butconventional-changelog-conventionalcommitswas not inpackage.json, so semantic-release stopped in its first step withCannot find module 'conventional-changelog-conventionalcommits'(for example run 42576776625). The runs that show as passing only got as far as "the local branch main is behind the remote one".Even with the module in place, a release would not have produced files. The tag semantic-release pushes sits on the
chore(release): ... [skip ci]commit, and when it is pushed withGITHUB_TOKENit starts no workflow. So the Linux AppImage and Windows builder workflows, which attach the files, would never have run. Separately, the Windows builder's release job was off unlessvars.CI_RELEASE_WINDOWSwas'true', which is why v2.0.7-rc.1 has only the AppImage andhookshot-linux.txt, with noHookshotBuilder.exeorhookshot-setup.txt.How releases work with this PR
Trigger: unchanged. Every push to
main(stable) ornext(release candidates) runs semantic-release, which picks the version from Conventional Commits since the lastv*tag, asdocs/versioning.mddescribes. A tag pushed by hand still works as it does today.package.jsonaddsconventional-changelog-conventionalcommits9.3.1 (the 9.x line matches commit-analyzer 13 and release-notes-generator 14; 10.x is a rewrite) and@semantic-release/github12.0.10. Apackage-lock.jsonis added, and the workflow usesnpm ci.nextis a prerelease. The GitHub plugin's issue and PR comments, labels and failure issues are turned off.workflow_dispatch, whichGITHUB_TOKENis allowed to do. On a tag ref they run exactly as on a pushed tag, so their existing build and release jobs are reused unchanged. Only that job hasactions: write; the semantic-release job keepscontents: write, and everything else is read-only.Hookshot-<tag>-x86_64.AppImage,hookshot-linux.txt,HookshotBuilder.exeandhookshot-setup.txt. New parts go to thelinux-partsandbuilder-partsreleases as before. Past releases ship no separate checksum file, so none is added; the setup lists already name each part by its SHA-256.vars.CI_RELEASE_WINDOWSis'false'.scripts/release_upload.shmarks anyvX.Y.Z-<prerelease>tag as a prerelease, not "latest". Before, only tags containing-rcwere. When the release already exists (made by semantic-release), it only adds files, and it replaces any that are already there (--clobber). Running the builds again on a tag therefore updates its files instead of failing. It also refuses file names that look like game data, dumps or NVIDIA runtime files (*.nso,*.nca,*romfs*,*nvngx*,*dlss*and so on), as a backstop.docs/versioning.mdis updated to match, andnode_modules/is added to.gitignore.Testing
scripts/release_upload.sh, andpython -I -B tests/run_all.pyreports 106 passed, 0 failed, 14 skipped.semantic-release --dry-runagainst a copy of current main with the new lockfile. It loads the preset, finds v2.0.6 and the commits since it, and computes 2.0.7 with notes.v0.0.0-test.1to hckrman101/Hookshot and ran both build workflows on that tag withworkflow_dispatch, the same call the Release workflow makes (https://github.com/hckrman101/Hookshot/actions/runs/42578234909 and https://github.com/hckrman101/Hookshot/actions/runs/42578265504). The release they made was a prerelease, not "latest", with GitHub's generated notes andhookshot-linux.txt,hookshot-setup.txt,Hookshot-v0.0.0-test.1-x86_64.AppImageandHookshotBuilder.exeattached. I then ran the Windows builder on the same tag again (https://github.com/hckrman101/Hookshot/actions/runs/42582057076). It replacedHookshotBuilder.exeandhookshot-setup.txtin place and did not fail. Its first attempt hit the 504 described below and passed on a re-run.nextbranch, I added a seed tagv0.0.0and afix:commit, which changed only package.json's repository URL to the fork. The push ran the Release workflow (https://github.com/hckrman101/Hookshot/actions/runs/42580051369). semantic-release computed 0.0.1-rc.1, pushed the tag withGITHUB_TOKEN, made the prerelease with its conventional-commits notes, and wrote the tag output, and the second job dispatched both builds. The tag push itself started no workflow, so nothing ran twice. Both builds attached their four files to the prerelease (https://github.com/hckrman101/Hookshot/actions/runs/42580092068 and https://github.com/hckrman101/Hookshot/actions/runs/42580095042). Twice, the Windows run got GitHub 504s on all five retries while downloading upstream'sreleases/download/v2.0.7/hookshot-setup.txt(release_parts.py previous), and both times a re-run passed. That download is older than this PR. If it keeps happening, fetching the asset through the API (assetup.cdoes) would avoid it. A second Release run on the same commit made no release.v0.0.0-test.1,v0.0.0,v0.0.1-rc.1, and the fork'sbuilder-partsandlinux-parts) and thenextbranch.What a maintainer needs to know or do
5656b04, a hotfix commit that is not on main. semantic-release only sees tags merged into the branch, so on main it still finds v2.0.6 as the last release, computes 2.0.7 from thefix:commits since, commits thechore(release): 2.0.7changelog entry to main, and then fails ongit tag v2.0.7because the tag already exists. I reproduced this locally. Merge5656b04into main first: it conflicts inscripts/linux/appimage.sh, where main has its own header fix. After that, the first Release run after the merge cuts v2.0.8 from thosefix:commits and builds its files. Every later merge with afeat:orfix:commit makes a release too, which is what docs/versioning.md already describes.mainandnexthave no branch protection, becauseGITHUB_TOKENcan push the release commit. If you protect them later, add aRELEASE_TOKENsecret (a fine-grained PAT with Contents: read and write on this repository, allowed to bypass the protection). The workflow already prefers it when it is set.GITHUB_TOKENat read, the Release workflow cannot push or dispatch.CI_RELEASE_WINDOWStofalse.gh workflow run linux-appimage.yml --ref <tag>).RELEASE_TOKEN) ever does start the tag workflows on the release tag in addition to the dispatch, each build runs twice. Both runs are in the same concurrency group, so they queue one after the other, and the second replaces the files with the same build.Which commits make a release
semantic-release only counts Conventional Commit subjects. It ignores merge commits, but it does read the commits a merge brings in. On main since v2.0.0, there are 332 commits: 128 merges, and of the 204 others, 66 are conventional, 21 of them
feat/fix/perf. Most of those 21 come from contributors' PRs. Most of the maintainers' own subjects are prose ("Pipeline state list: ...", "Lift: ..."), and those neither trigger a release nor appear in the notes orchangelog.txt. So with this fix, releases would happen whenever a contributor'sfix:orfeat:lands, and a run of prose-only changes would never release. If that does not match how you want to cut versions, use conventional subjects (fix(vk): ...), or squash-merge with a conventional PR title.Alternative: release-please
release-please would replace semantic-release with a release PR that it keeps up to date. A maintainer merges that PR to cut each version. The changelog in the PR can be edited before merging, every release goes through a human, and no npm install is needed in CI. It reads the same Conventional Commits, so prose subjects would still be left out unless the release PR is edited or
Release-As:is used. Its tag and release are made withGITHUB_TOKENtoo, so it has the same caveat: it needs aRELEASE_TOKENPAT for the tag to start the build workflows, or the build workflows dispatched or called from the same workflow, as this PR does. I kept semantic-release because it is whatrelease.yml,.releaserc.jsonanddocs/versioning.mdalready set up, but I can switch this PR to release-please if you prefer.Closing: this fixed the semantic-release workflow, but the release process is being replaced with release-please instead (a release PR with the changelog, files attached when it's merged). That comes as a new PR, along with a PR title check so titles are conventional.