1- # Release pipeline: a `vX.Y.Z` tag builds installers for macOS, Windows and Linux and creates or
2- # updates the draft GitHub Release "Redrob Board vX.Y.Z". Adapted from redrob-launcher.
1+ # Release pipeline: a `vX.Y.Z` tag builds installers for macOS, Windows and Linux and the browser
2+ # build, then publishes the GitHub Release "Redrob Board vX.Y.Z". Adapted from redrob-launcher.
33#
44# The tag must equal the Cargo.toml version; the version job fails otherwise. The jobs that sign
5- # (macOS, Windows) and the one that drafts the GitHub Release run in the `release` environment.
5+ # (macOS, Windows) and the one that publishes the GitHub Release run in the `release` environment.
66# Signing secrets are the redrob-labs organization's (Apple Developer ID certificate + App Store
77# Connect API key for notarization; Azure Artifact Signing account IDs, reached over OpenID Connect,
88# for Windows). Every secret is optional: missing ones produce unsigned artifacts and a warning,
9- # never a failed build. A manual dispatch is a dry run: it builds every job and drafts nothing.
9+ # never a failed build. A manual dispatch is a dry run: it builds every job and publishes nothing.
1010#
1111# Every job checks out the one commit the version job resolved, so a push that lands mid-run
1212# cannot split the binaries from the tag.
@@ -291,7 +291,7 @@ jobs:
291291 if-no-files-found : error
292292
293293 release :
294- name : Draft GitHub Release
294+ name : Publish GitHub Release
295295 needs : [version, macos, windows, linux, web]
296296 # Only a version tag publishes; a manual dispatch stops before this job.
297297 if : github.ref_type == 'tag'
@@ -315,30 +315,32 @@ jobs:
315315 working-directory : artifacts
316316 run : |
317317 sha256sum -- * | tee SHA256SUMS.txt
318- - name : Create or update the draft release
318+ - name : Publish the release
319319 working-directory : artifacts
320320 run : |
321321 tag="v$VERSION"
322322 title="Redrob Board v$VERSION"
323- pre=()
324- if [ "$PRERELEASE" = true ]; then pre=(--prerelease); fi
323+ # A stable version becomes "latest"; a prerelease never does.
324+ flags=(--latest)
325+ if [ "$PRERELEASE" = true ]; then flags=(--prerelease --latest=false); fi
325326 if draft="$(gh release view "$tag" --json isDraft --jq .isDraft 2>/dev/null)"; then
326327 if [ "$draft" != "true" ]; then
327328 echo "::error::Release $tag is already published. Bump the version (cargo xtask version set) and tag again."
328329 exit 1
329330 fi
330- echo "Updating draft $tag: replacing its assets"
331+ # A draft left by an earlier run (or made by hand): replace its assets and publish it.
332+ echo "Publishing existing draft $tag with fresh assets"
331333 gh release view "$tag" --json assets --jq '.assets[].name' | while read -r asset; do
332334 gh release delete-asset "$tag" "$asset" --yes
333335 done
334- gh release edit "$tag" --draft --title "$title" --target "$SHA" --prerelease="$PRERELEASE"
335336 gh release upload "$tag" --clobber -- *
337+ gh release edit "$tag" --draft=false --title "$title" --target "$SHA" "${flags[@]}"
336338 else
337- echo "Creating draft $tag"
338- gh release create "$tag" --draft -- title "$title" --target "$SHA" --generate-notes "${pre [@]}" -- *
339+ echo "Publishing $tag"
340+ gh release create "$tag" --title "$title" --target "$SHA" --generate-notes "${flags [@]}" -- *
339341 fi
340342 {
341- echo "Draft release **$title** at \`${SHA::9}\`:"
343+ echo "Published **$title** at \`${SHA::9}\`:"
342344 echo
343345 sed 's/^/ /' SHA256SUMS.txt
344346 } >>"$GITHUB_STEP_SUMMARY"
0 commit comments