Skip to content

Commit 2def83b

Browse files
committed
Release: publish on tag, no draft
The release job creates the GitHub Release published, marked latest for a stable version and prerelease otherwise. A draft left by an earlier run is filled with fresh assets and published. An already published tag still fails the job: bump and tag again.
1 parent 223a229 commit 2def83b

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
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"

‎README.ko.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ KiCad 플롯과 픽셀 일치, KiCad DRC 0), 자체 스트로크 폰트 실크
6666
릴리즈에는 서명·공증된 macOS 디스크 이미지(universal), 서명된 Windows 설치 파일과 포터블 zip(x64·arm64),
6767
Linux AppImage/deb/rpm/tar.gz(x86_64·aarch64)가 있습니다:
6868
[github.com/redrob-labs/redrob-board/releases](https://github.com/redrob-labs/redrob-board/releases).
69-
`vX.Y.Z` 태그가 `.github/workflows/release.yml`을 돌려 한 커밋에서 모든 잡을 빌드하고 드래프트 릴리즈를 만듭니다.
69+
`vX.Y.Z` 태그가 `.github/workflows/release.yml`을 돌려 한 커밋에서 모든 잡을 빌드하고 릴리즈를 발행합니다.
7070
패키징 스크립트는 `packaging/`에 있습니다. 릴리즈에는 브라우저 빌드(`redrob-board-web-<버전>.zip`, 정적 WebAssembly 사이트,
7171
호스팅 안내는 `packaging/web/README.md`)도 들어갑니다: 엔진 없는 같은 창이라 AGENT 팔레트가 그 사실을 말합니다.
7272

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Releases carry a signed and notarized macOS disk image (universal), signed Windo
8686
and portable zips (x64, arm64) and Linux AppImage/deb/rpm/tar.gz (x86_64, aarch64):
8787
[github.com/redrob-labs/redrob-board/releases](https://github.com/redrob-labs/redrob-board/releases).
8888
A `vX.Y.Z` tag runs `.github/workflows/release.yml`, which builds every job from one commit and
89-
drafts the release; the packaging scripts live in `packaging/`. The release also carries a
89+
publishes the release; the packaging scripts live in `packaging/`. The release also carries a
9090
browser build (`redrob-board-web-<version>.zip`, a static WebAssembly site; `packaging/web/README.md`
9191
has the hosting notes): the same window without the engine, so the AGENT palette says so.
9292

0 commit comments

Comments
 (0)