Skip to content

Commit 177b320

Browse files
authored
Sign builds with GnuPG (#26)
1 parent 0899763 commit 177b320

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

.github/workflows/build.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- 'main'
77
pull_request:
8-
8+
99
# This ensures that jobs get canceled when force-pushing
1010
concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
@@ -49,6 +49,16 @@ jobs:
4949
sudo apt-get -y install qemu-user-static
5050
./chroot_build.sh
5151
52+
- name: Sign
53+
env:
54+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
55+
# skip signing if secret is not available (e.g., if run from a PR made by somebody outside of this repository)
56+
if: ${{ env.SIGNING_KEY == '' }}
57+
run: |
58+
./sign.sh out/runtime-*
59+
# copy pubkey so that it's included with the files uploaded to the release page
60+
cp signing-pubkey.asc out/
61+
5262
- uses: actions/upload-artifact@v3
5363
with:
5464
name: artifacts

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ export ARCHITECTURE=x86_64
2525
```
2626

2727
This whole process takes only a few seconds, e.g., on GitHub Codespaces.
28+
29+
30+
## Signing
31+
32+
Release builds are signed automatically using GnuPG. The corresponding public key can be found in the file `signing-pubkey.asc`.

sign.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#! /bin/bash
2+
3+
set -euo pipefail
4+
5+
if [[ "${SIGNING_KEY:-}" == "" ]] || [[ ! -f "${1:-}" ]]; then
6+
echo "Usage: env SIGNING_KEY=... $0 runtime-<arch>"
7+
exit 2
8+
fi
9+
10+
tmpdir="$(mktemp -d)"
11+
chmod 0700 "$tmpdir"
12+
13+
cleanup() {
14+
if [[ -d "$tmpdir" ]]; then
15+
rm -rf "$tmpdir"
16+
fi
17+
}
18+
19+
trap cleanup EXIT
20+
21+
export GNUPGHOME="$tmpdir"
22+
23+
echo "=== importing key ==="
24+
echo -e "$SIGNING_KEY" | gpg2 --verbose --batch --import
25+
26+
echo
27+
echo "=== listing available secret keys ==="
28+
gpg2 -K
29+
30+
echo
31+
echo "=== signing $1 ==="
32+
gpg2 --verbose --batch --sign --detach -o "$1".sig "$1"
33+
34+
echo
35+
echo "=== test-verifying signature ==="
36+
gpg2 --verbose --batch --verify "$1".sig "$1"

signing-pubkey.asc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----BEGIN PGP PUBLIC KEY BLOCK-----
2+
3+
mDMEZjaeexYJKwYBBAHaRw8BAQdAhvHdHoBweX0uVRgfcnlzexrSg+TAbK2mU1TA
4+
gi0TMC20NEFwcEltYWdlIHR5cGUgMiBydW50aW1lIDx0eXBlMi1ydW50aW1lQGFw
5+
cGltYWdlLm9yZz6IlgQTFggAPgIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgBYh
6+
BFcMd6zqQMDxt1iQLL+WzKVkkPaVBQJmN7FgBQkSzRXlAAoJEL+WzKVkkPaVCXsA
7+
/0JxQPlr2AlKalt9LAGCXU633gBoXh8/sQQngGGWjhT2APoCls0XWL2qhx1jAIdr
8+
AqDmOi3bdzBOpWBBIsOexhbdBrg4BGY2nnsSCisGAQQBl1UBBQEBB0CRVIEEu+Ft
9+
W68O33iZCVDMIYUWdD59iXfQ7rHf8HxAEgMBCAeIfgQYFggAJhYhBFcMd6zqQMDx
10+
t1iQLL+WzKVkkPaVBQJmNp57AhsMBQkDwmcAAAoJEL+WzKVkkPaVY7oA/icTs/E6
11+
47LTon7ua021HdjQlwkHZOpa/hqBWQEB3w6GAQCbaPRxKcNN9Yfwxc6cIvfUORKz
12+
+4OQzyesHV5P4fYLDw==
13+
=r/5H
14+
-----END PGP PUBLIC KEY BLOCK-----

0 commit comments

Comments
 (0)