Skip to content

Commit 7c142a6

Browse files
authored
Attempt to use github immutable releases (#11902)
[Immutable Releases] look to be a relatively new feature on github which is a natural fit for us where we have no need to modify release assets after creation. My failed attempt to enable this earlier turned out to, expectedly, not work. This commit is an attempt to make things work. Specifically releases are now created as a draft initially, then release assets are attached, and finally it's automatically marked as a non-draft. While one could make a reasonable argument that a human should be involved in making the release a non-draft there's also something nice about just hitting merge on a PR and letting the release ride through CI. [Immutable Releases]: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases
1 parent aba7144 commit 7c142a6

File tree

1 file changed

+10
-0
lines changed
  • .github/actions/github-release

1 file changed

+10
-0
lines changed

.github/actions/github-release/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ async function runOnce() {
9999
repo,
100100
tag_name: name,
101101
prerelease: name === 'dev',
102+
draft: name !== 'dev',
102103
};
103104
if (name !== 'dev') {
104105
for (let x of releaseNotes.split(/^---+$/m)) {
@@ -140,6 +141,15 @@ async function runOnce() {
140141
url: release.data.upload_url,
141142
});
142143
}
144+
145+
if (name !== 'dev') {
146+
octokit.rest.repos.updateRelease({
147+
owner,
148+
repo,
149+
release_id: release.id,
150+
draft: false,
151+
});
152+
}
143153
}
144154

145155
async function run() {

0 commit comments

Comments
 (0)