diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml index dde2209e..b17ca664 100644 --- a/.gitea/workflows/publish.yml +++ b/.gitea/workflows/publish.yml @@ -360,6 +360,7 @@ jobs: REPO: ${{ github.repository }} PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} TOKEN: ${{ secrets.GITHUB_TOKEN }} + MINISIGN_SECRET_KEY: ${{ secrets.MINISIGN_SECRET_KEY }} steps: - name: take the binaries out of the image run: | @@ -387,6 +388,24 @@ jobs: done sha256sum inbuxa-linux-*.tar.gz inbuxa-relay-* > SHA256SUMS cat SHA256SUMS + # Sign SHA256SUMS with the suite's minisign key, so a download can be + # verified against the public key the docs publish. This is separate + # from the relay .sig (relay-sign), which the server uses only to let a + # relay take a binary as an upgrade. No key (as on a fork, or before the + # key is added) leaves the release unsigned. + - name: sign SHA256SUMS with minisign + run: | + set -euo pipefail + if [ -z "${MINISIGN_SECRET_KEY:-}" ]; then + echo "::warning::MINISIGN_SECRET_KEY is not set; this release will be unsigned" + exit 0 + fi + apk add --no-cache -q minisign + umask 077 + key="$(mktemp)"; printf '%s\n' "$MINISIGN_SECRET_KEY" > "$key" + minisign -S -s "$key" -m /out/SHA256SUMS -t "inbuxa $TAG" + rm -f "$key" + echo "signed /out/SHA256SUMS -> /out/SHA256SUMS.minisig" - name: attach them to the release run: | set -euo pipefail @@ -405,7 +424,9 @@ jobs: for path in ["/out/inbuxa-linux-amd64.tar.gz", "/out/inbuxa-linux-arm64.tar.gz", "/out/inbuxa-relay-x86_64-linux-musl", "/out/inbuxa-relay-aarch64-linux-musl", - "/out/SHA256SUMS"]: + "/out/SHA256SUMS", "/out/SHA256SUMS.minisig"]: + if not pathlib.Path(path).exists(): + continue # SHA256SUMS.minisig is absent only on an unsigned release name = os.path.basename(path) # A re-run of a tag replaces its assets rather than leaving two # files with the same name and different contents.