publish runs under `set -e`, so a transient Gitea storage failure during the asset upload left a release with no assets and every later step skipped — and a re-run could not recover it, because the release already existed and `release create` refused. Detect an existing release and re-upload the assets with --clobber instead, so `publish <version>` can simply be re-run to finish the job. Update the AUR recipe before the upload, not after: the PKGBUILD is one of the release assets, so it must already point at this release rather than carry the previous version's sha. Its post-release commit is likewise no longer gated on --aur, since the recipe is now updated unconditionally and an uncommitted one would dirty the tree the next publish requires to be clean. A Nostr failure now warns instead of aborting, matching the mirror policy already documented in build-aux/AGENTS.md.
This commit is contained in:
2 files changed
+55
-26
No files matched your search
@@ -73,6 +73,16 @@ the UI is tested. `build-aux/deploy-dev.sh` runs on the build host,
|
||||
place at the end** (`release.env` written last), so an interrupted run leaves
|
||||
the previous release intact instead of a new tarball beside an old
|
||||
`release.env` — and `dist/` holds one version at a time.
|
||||
- **`publish` is resumable.** It runs under `set -e`, so a mid-way failure (a
|
||||
transient Gitea storage error once left the release with no assets and every
|
||||
later step skipped) used to be unrecoverable: the release existed, so a re-run
|
||||
died on `release create`. It now detects an existing release and re-uploads the
|
||||
assets with `--clobber`, so re-running `publish <version>` finishes the job.
|
||||
The AUR recipe is updated **before** the upload because the PKGBUILD is itself
|
||||
a release asset and must not carry the previous version's sha; the post-release
|
||||
commit that records it is therefore not gated on `--aur` (an uncommitted recipe
|
||||
would dirty the tree the next `publish` demands be clean). A Nostr failure warns
|
||||
rather than aborts, matching the mirror's non-fatal policy.
|
||||
- **The version exists in three dialects, derived in exactly one place**
|
||||
(`release.sh`), because AppStream *and* pacman sort a `-`/`.`-separated
|
||||
pre-release **above** the final release: `1.0.0-beta.1`
|
||||
|
||||
+45
-26
@@ -373,27 +373,42 @@ stage_publish() {
|
||||
warn "publishing without --draft while pushing nothing; the post-release commit will stay local"
|
||||
fi
|
||||
|
||||
# The PKGBUILD is uploaded as a release asset, so it must already point at this
|
||||
# release. The real sha only exists once the tarball does, which is why this
|
||||
# cannot live in `prepare` — and why it must run before the upload below, not
|
||||
# beside the AUR push.
|
||||
local sha
|
||||
sha=$(cut -d' ' -f1 "$DIST/regent-$version.tar.xz.sha256sum")
|
||||
hdr "updating the AUR recipe"
|
||||
sed -i -e "s/^pkgver=.*/pkgver=$PKGVER/" \
|
||||
-e "s/^_tag=.*/_tag=$version/" \
|
||||
-e "s/^_fingerprint=.*/_fingerprint=$r_fingerprint/" \
|
||||
-e "s/^sha256sums=.*/sha256sums=('$sha' 'SKIP')/" \
|
||||
build-aux/aur/regent/PKGBUILD
|
||||
|
||||
hdr "creating the Gitea release"
|
||||
local args=(release create "$tag" --verify-tag
|
||||
"$DIST/regent-$version.tar.xz"
|
||||
"$DIST/regent-$version.tar.xz.sha256sum"
|
||||
"$DIST/regent-$version.tar.xz.asc"
|
||||
"$DIST/regent-signing-key.asc"
|
||||
build-aux/aur/regent/PKGBUILD
|
||||
-F "$DIST/notes.md")
|
||||
[ "$prerelease" = yes ] && args+=(--prerelease)
|
||||
[ "$draft" = yes ] && args+=(--draft)
|
||||
gt "${args[@]}"
|
||||
# An existing release means an earlier `publish` got this far and then failed
|
||||
# (a transient Gitea storage error, say). Refresh the notes and re-upload the
|
||||
# assets with --clobber instead of dying on `release create`, so re-running
|
||||
# `publish` resumes rather than refusing.
|
||||
local assets=( "$DIST/regent-$version.tar.xz"
|
||||
"$DIST/regent-$version.tar.xz.sha256sum"
|
||||
"$DIST/regent-$version.tar.xz.asc"
|
||||
"$DIST/regent-signing-key.asc"
|
||||
build-aux/aur/regent/PKGBUILD )
|
||||
if gt release view "$tag" --json tag >/dev/null 2>&1; then
|
||||
log "release $tag already exists; refreshing its assets"
|
||||
gt release edit "$tag" -F "$DIST/notes.md"
|
||||
gt release upload "$tag" "${assets[@]}" --clobber
|
||||
else
|
||||
local args=(release create "$tag" --verify-tag "${assets[@]}" -F "$DIST/notes.md")
|
||||
[ "$prerelease" = yes ] && args+=(--prerelease)
|
||||
[ "$draft" = yes ] && args+=(--draft)
|
||||
gt "${args[@]}"
|
||||
fi
|
||||
|
||||
if [ "$aur" = yes ]; then
|
||||
hdr "updating the AUR"
|
||||
local sha
|
||||
sha=$(cut -d' ' -f1 "$DIST/regent-$version.tar.xz.sha256sum")
|
||||
sed -i -e "s/^pkgver=.*/pkgver=$PKGVER/" \
|
||||
-e "s/^_tag=.*/_tag=$version/" \
|
||||
-e "s/^_fingerprint=.*/_fingerprint=$r_fingerprint/" \
|
||||
-e "s/^sha256sums=.*/sha256sums=('$sha' 'SKIP')/" \
|
||||
build-aux/aur/regent/PKGBUILD
|
||||
hdr "pushing the AUR recipe"
|
||||
AUR_TMP=$(mktemp -d)
|
||||
trap '[ -n "${AUR_TMP:-}" ] && rm -rf "$AUR_TMP"' EXIT
|
||||
local pkg url
|
||||
@@ -418,16 +433,20 @@ stage_publish() {
|
||||
if [ "$nostr" = yes ]; then
|
||||
hdr "publishing the Nostr release"
|
||||
local channel=main; [ "$prerelease" = yes ] && channel=beta
|
||||
ngit release publish "$version" --tag "$tag" --channel "$channel"
|
||||
# Nostr is a mirror: a failure here must not abort the rest of the release,
|
||||
# and a re-run after a successful publish must not hard-fail either.
|
||||
ngit release publish "$version" --tag "$tag" --channel "$channel" \
|
||||
|| warn "Nostr publish failed; retry later: ngit release publish $version --tag $tag --channel $channel"
|
||||
fi
|
||||
|
||||
if [ "$aur" = yes ]; then
|
||||
hdr "post-release"
|
||||
git add build-aux/aur/regent/PKGBUILD
|
||||
if ! git diff --cached --quiet; then
|
||||
git commit -m "Post-release: point the AUR recipe at $version"
|
||||
[ "$push" = yes ] && git push "$REMOTE" main
|
||||
fi
|
||||
# Not gated on $aur: the recipe was updated above so its release asset is
|
||||
# current, and leaving it uncommitted would dirty the tree — which the next
|
||||
# `publish` (require_clean_main) refuses to run from.
|
||||
hdr "post-release"
|
||||
git add build-aux/aur/regent/PKGBUILD
|
||||
if ! git diff --cached --quiet; then
|
||||
git commit -m "Post-release: point the AUR recipe at $version"
|
||||
[ "$push" = yes ] && git push "$REMOTE" main
|
||||
fi
|
||||
|
||||
hdr "done"
|
||||
|
||||
Reference in new issue
Block a user