Compare commits
2 changed files with 28 additions and 80 deletions
|
|
@ -416,11 +416,7 @@ jobs:
|
||||||
# Pi runner, not docker-amd64: the amd64 dind runner is capacity=1 and
|
# Pi runner, not docker-amd64: the amd64 dind runner is capacity=1 and
|
||||||
# android-release sat in front of run 116's publish for ~1h; the Pi
|
# android-release sat in front of run 116's publish for ~1h; the Pi
|
||||||
# already created the tag over the public API (version job), so publish
|
# already created the tag over the public API (version job), so publish
|
||||||
# uses that same path. This job needs the docker CLI for one thing only —
|
# uses that same path. This job only curls the Forgejo API — no docker CLI.
|
||||||
# running scripts/sign-release.sh in the pinned builder image — and it uses
|
|
||||||
# a named volume + docker cp, never a bind mount of $GITHUB_WORKSPACE
|
|
||||||
# (that path exists only inside this container; docker resolves a -v source
|
|
||||||
# on the host and hands the container an empty /work — run 768).
|
|
||||||
# Fail-closed tag delete lives as a step here: a sibling cleanup job ran
|
# Fail-closed tag delete lives as a step here: a sibling cleanup job ran
|
||||||
# after a successful publish (act treats needs.publish.result as unset, so
|
# after a successful publish (act treats needs.publish.result as unset, so
|
||||||
# != success) and Early-terminated on run 135. Do not restore that job.
|
# != success) and Early-terminated on run 135. Do not restore that job.
|
||||||
|
|
@ -450,35 +446,11 @@ jobs:
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: artifacts
|
||||||
|
|
||||||
- name: Stage both arch artifacts into dist
|
|
||||||
if: needs.version.outputs.dry_run != 'true' && needs.aarch64.result == 'success' && needs.x86_64.result == 'success'
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
# Everything the signer signs must already be in dist/ when the sign
|
|
||||||
# step runs. This loop used to live inside the publish step, i.e.
|
|
||||||
# AFTER the signature step, so signing ran against an empty dist/.
|
|
||||||
mkdir -p dist
|
|
||||||
find artifacts -type f -print
|
|
||||||
for target in aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu; do
|
|
||||||
for name in "onionwire-$target" "onionwire-$target.sha256" "build-info-$target.txt"; do
|
|
||||||
src=$(find artifacts -type f -name "$name" -print -quit)
|
|
||||||
if [ -z "$src" ]; then
|
|
||||||
echo "missing artifact: $name" >&2
|
|
||||||
find artifacts -type f >&2 || true
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cp "$src" "dist/$name"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
ls -l dist
|
|
||||||
|
|
||||||
- name: Sign the release assets (minisign, fail closed)
|
- name: Sign the release assets (minisign, fail closed)
|
||||||
if: needs.version.outputs.dry_run != 'true' && needs.aarch64.result == 'success' && needs.x86_64.result == 'success'
|
if: needs.version.outputs.dry_run != 'true' && needs.aarch64.result == 'success' && needs.x86_64.result == 'success'
|
||||||
env:
|
env:
|
||||||
MINISIGN_SECRET_KEY: ${{ secrets.MINISIGN_SECRET_KEY }}
|
MINISIGN_SECRET_KEY: ${{ secrets.MINISIGN_SECRET_KEY }}
|
||||||
RELEASE_TAG: ${{ needs.version.outputs.tag }}
|
RELEASE_TAG: ${{ needs.version.outputs.tag }}
|
||||||
SIGN_VOLUME: onionwire-sign-${{ github.run_id }}
|
|
||||||
SIGN_CONTAINER: onionwire-sign-${{ github.run_id }}
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
# Signing runs BEFORE publish on purpose. A run without the key stops
|
# Signing runs BEFORE publish on purpose. A run without the key stops
|
||||||
|
|
@ -490,46 +462,20 @@ jobs:
|
||||||
echo "See docs/VERIFY.md, \"Maintainer: the signing key\"." >&2
|
echo "See docs/VERIFY.md, \"Maintainer: the signing key\"." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# NO `-v "${GITHUB_WORKSPACE}:/work"`: GITHUB_WORKSPACE is a path
|
# minisign comes from the same pinned image the builds used, so our
|
||||||
# INSIDE this job container, but docker resolves a bind mount's source
|
# signature and the verifier's check are the same implementation.
|
||||||
# on the HOST, where it does not exist. Docker then creates an empty
|
docker run --rm \
|
||||||
# /work and the sign script is simply absent (run 768: "bash:
|
-v "${GITHUB_WORKSPACE}:/work" \
|
||||||
# .ci-tools/scripts/sign-release.sh: No such file or directory").
|
|
||||||
# Same pattern as the build jobs: named volume + docker cp in/out.
|
|
||||||
# minisign still comes from the same pinned image the builds used, so
|
|
||||||
# our signature and the verifier's check are the same implementation.
|
|
||||||
cleanup() {
|
|
||||||
docker rm -f "$SIGN_CONTAINER" >/dev/null 2>&1 || true
|
|
||||||
docker volume rm "$SIGN_VOLUME" >/dev/null 2>&1 || true
|
|
||||||
}
|
|
||||||
trap cleanup EXIT
|
|
||||||
docker volume create "$SIGN_VOLUME" >/dev/null
|
|
||||||
docker rm -f "$SIGN_CONTAINER" >/dev/null 2>&1 || true
|
|
||||||
docker create --name "$SIGN_CONTAINER" \
|
|
||||||
-e MINISIGN_SECRET_KEY \
|
-e MINISIGN_SECRET_KEY \
|
||||||
-e RELEASE_TAG \
|
-e RELEASE_TAG \
|
||||||
-v "$SIGN_VOLUME:/work" \
|
|
||||||
-w /work \
|
-w /work \
|
||||||
"$RUST_IMAGE" \
|
"$RUST_IMAGE" \
|
||||||
bash -c 'apt-get update -qq && apt-get install -y -qq --no-install-recommends minisign >/dev/null \
|
bash -c 'apt-get update -qq && apt-get install -y -qq --no-install-recommends minisign >/dev/null \
|
||||||
&& bash /work/scripts/sign-release.sh \
|
&& bash .ci-tools/scripts/sign-release.sh \
|
||||||
/work/dist/onionwire-aarch64-unknown-linux-gnu \
|
dist/onionwire-aarch64-unknown-linux-gnu \
|
||||||
/work/dist/onionwire-aarch64-unknown-linux-gnu.sha256 \
|
dist/onionwire-aarch64-unknown-linux-gnu.sha256 \
|
||||||
/work/dist/onionwire-x86_64-unknown-linux-gnu \
|
dist/onionwire-x86_64-unknown-linux-gnu \
|
||||||
/work/dist/onionwire-x86_64-unknown-linux-gnu.sha256'
|
dist/onionwire-x86_64-unknown-linux-gnu.sha256'
|
||||||
docker cp .ci-tools/scripts "$SIGN_CONTAINER:/work/scripts"
|
|
||||||
docker cp dist/. "$SIGN_CONTAINER:/work/dist/"
|
|
||||||
docker start -a "$SIGN_CONTAINER"
|
|
||||||
docker cp "$SIGN_CONTAINER:/work/dist/." dist/
|
|
||||||
# Verify the signatures came back out before anything is published.
|
|
||||||
for f in \
|
|
||||||
dist/onionwire-aarch64-unknown-linux-gnu.minisig \
|
|
||||||
dist/onionwire-aarch64-unknown-linux-gnu.sha256.minisig \
|
|
||||||
dist/onionwire-x86_64-unknown-linux-gnu.minisig \
|
|
||||||
dist/onionwire-x86_64-unknown-linux-gnu.sha256.minisig
|
|
||||||
do
|
|
||||||
[ -s "$f" ] || { echo "signing produced no $f" >&2; exit 1; }
|
|
||||||
done
|
|
||||||
# The public key ships as an asset too, so a verifier can get it from
|
# The public key ships as an asset too, so a verifier can get it from
|
||||||
# the release; getting it from the repo instead is stronger, and
|
# the release; getting it from the repo instead is stronger, and
|
||||||
# docs/VERIFY.md says so.
|
# docs/VERIFY.md says so.
|
||||||
|
|
@ -543,9 +489,19 @@ jobs:
|
||||||
TAG: ${{ needs.version.outputs.tag }}
|
TAG: ${{ needs.version.outputs.tag }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
# dist/ is staged and signed by the two steps above; this step only
|
mkdir -p dist
|
||||||
# refuses to upload a hole in it.
|
find artifacts -type f -print
|
||||||
find dist -type f -print
|
for target in aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu; do
|
||||||
|
for name in "onionwire-$target" "onionwire-$target.sha256" "build-info-$target.txt"; do
|
||||||
|
src=$(find artifacts -type f -name "$name" -print -quit)
|
||||||
|
if [ -z "$src" ]; then
|
||||||
|
echo "missing artifact: $name" >&2
|
||||||
|
find artifacts -type f >&2 || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cp "$src" "dist/$name"
|
||||||
|
done
|
||||||
|
done
|
||||||
missing=0
|
missing=0
|
||||||
for f in \
|
for f in \
|
||||||
dist/onionwire-aarch64-unknown-linux-gnu \
|
dist/onionwire-aarch64-unknown-linux-gnu \
|
||||||
|
|
|
||||||
|
|
@ -110,19 +110,11 @@ The `SOURCE_DATE_EPOCH` step reads the committer time of
|
||||||
`needs.version.outputs.sha`. It is deliberately not "now": a rebuild of this tag
|
`needs.version.outputs.sha`. It is deliberately not "now": a rebuild of this tag
|
||||||
in six months has to hand the compiler the same epoch CI handed it.
|
in six months has to hand the compiler the same epoch CI handed it.
|
||||||
|
|
||||||
`publish` job (Pi runner) downloads both artifacts, stages them into `dist/`,
|
`publish` job (Pi runner) downloads both artifacts, refuses any empty file,
|
||||||
signs every asset with `scripts/sign-release.sh` inside the same digest-pinned
|
and calls `scripts/publish-release.sh` to create-or-update the release with all
|
||||||
builder image, and only then calls `scripts/publish-release.sh` to create-or-update
|
four Linux assets. If this job fails and the tag was created by *this* run, the
|
||||||
the release with all four Linux assets plus the committed public key. Signing runs
|
final step deletes the incomplete release and the tag. A failed `aarch64` or
|
||||||
in a container fed by a **named volume + `docker cp`**, not a bind mount of the
|
`x86_64` job always fails `publish`, so nothing is published half-built.
|
||||||
workspace: on this runner `$GITHUB_WORKSPACE` is a path inside the job container,
|
|
||||||
while docker resolves a `-v` source on the host — a bind mount therefore arrives
|
|
||||||
empty and the sign script is missing (run 768). Signing is also staged *after*
|
|
||||||
`dist/` is populated, so the files it signs exist; a run with no
|
|
||||||
`MINISIGN_SECRET_KEY` still stops before anything is uploaded. If this job fails
|
|
||||||
and the tag was created by *this* run, the final step deletes the incomplete
|
|
||||||
release and the tag. A failed `aarch64` or `x86_64` job always fails `publish`, so
|
|
||||||
nothing is published half-built.
|
|
||||||
|
|
||||||
## Android (APK + AAR) on the same tag
|
## Android (APK + AAR) on the same tag
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue