File tree Expand file tree Collapse file tree 3 files changed +79
-0
lines changed Expand file tree Collapse file tree 3 files changed +79
-0
lines changed Original file line number Diff line number Diff line change @@ -1285,6 +1285,24 @@ jobs:
1285
1285
GCLOUD_ACCESS_TOKEN : ${{ steps.gcloud_auth.outputs.access_token }}
1286
1286
JSIGN_PATH : /tmp/jsign-6.0.jar
1287
1287
1288
+ - name : Sign binaries with GPG
1289
+ run : |
1290
+ set -euo pipefail
1291
+
1292
+ for binary in ./build/coder_{darwin,linux,windows}*; do
1293
+ if [[ -f "$binary" ]]; then
1294
+ ./scripts/sign_with_gpg.sh "$binary"
1295
+ fi
1296
+ done
1297
+ env :
1298
+ CODER_GPG_RELEASE_KEY_BASE64 : ${{ secrets.CODER_GPG_RELEASE_KEY_BASE64 }}
1299
+
1300
+ - name : Insert signatures
1301
+ run : |
1302
+ for sigfile in ./build/*.sig; do
1303
+ mv "$sigfile" ./site/out/bin/
1304
+ done
1305
+
1288
1306
- name : Build Linux Docker images
1289
1307
id : build-docker
1290
1308
env :
Original file line number Diff line number Diff line change @@ -342,6 +342,24 @@ jobs:
342
342
- name : Delete Windows EV Signing Cert
343
343
run : rm /tmp/ev_cert.pem
344
344
345
+ - name : Sign binaries with GPG
346
+ run : |
347
+ set -euo pipefail
348
+
349
+ for binary in ./build/coder_{darwin,linux,windows}*; do
350
+ if [[ -f "$binary" ]]; then
351
+ ./scripts/sign_with_gpg.sh "$binary"
352
+ fi
353
+ done
354
+ env :
355
+ CODER_GPG_RELEASE_KEY_BASE64 : ${{ secrets.CODER_GPG_RELEASE_KEY_BASE64 }}
356
+
357
+ - name : Insert signatures
358
+ run : |
359
+ for sigfile in ./build/*.sig; do
360
+ mv "$sigfile" ./site/out/bin/
361
+ done
362
+
345
363
- name : Determine base image tag
346
364
id : image-base-tag
347
365
run : |
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # This script signs a given binary using GPG.
4
+ # It expects the binary to be signed as the first argument.
5
+ #
6
+ # Usage: ./sign_with_gpg.sh path/to/binary
7
+ #
8
+ # On success, the input file will be signed using the GPG key.
9
+ #
10
+ # Depends on the GPG utility. Requires the following environment variables to be set:
11
+ # - $CODER_GPG_RELEASE_KEY_BASE64: The base64 encoded private key to use.
12
+
13
+ set -euo pipefail
14
+
15
+ requiredenvs CODER_GPG_RELEASE_KEY_BASE64
16
+
17
+ FILE_TO_SIGN=" $1 "
18
+
19
+ if [[ -z " $FILE_TO_SIGN " ]]; then
20
+ echo " Usage: $0 <file_to_sign>"
21
+ exit 1
22
+ fi
23
+
24
+ if [[ ! -f " $FILE_TO_SIGN " ]]; then
25
+ echo " File not found: $FILE_TO_SIGN "
26
+ exit 1
27
+ fi
28
+
29
+ # Import the private key.
30
+ echo " $CODER_GPG_RELEASE_KEY_BASE64 " | base64 --decode | gpg --import 1>&2
31
+
32
+ # Sign the binary.
33
+ gpg --detach-sign --armor " $FILE_TO_SIGN " 1>&2
34
+
35
+ # Verify the signature.
36
+ gpg --verify " ${FILE_TO_SIGN} .sig" " $FILE_TO_SIGN " 1>&2
37
+
38
+ if [[ $? -eq 0 ]]; then
39
+ echo " ${FILE_TO_SIGN} .sig"
40
+ else
41
+ echo " Signature verification failed!" >&2
42
+ exit 1
43
+ fi
You can’t perform that action at this time.
0 commit comments