Skip to content

Commit ddd2ada

Browse files
chore: add comments and invoke the sign_with_gpg.sh script from publish.sh
1 parent e80259c commit ddd2ada

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

scripts/build_go.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
# binary will be signed using ./sign_darwin.sh. Read that file for more details
2121
# on the requirements.
2222
#
23+
# If the --sign-gpg parameter is specified, the output binary will be signed using ./sign_with_gpg.sh.
24+
# Read that file for more details on the requirements.
25+
#
2326
# If the --agpl parameter is specified, builds only the AGPL-licensed code (no
2427
# Coder enterprise features).
2528
#

scripts/release/publish.sh

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -129,26 +129,9 @@ if [[ "$dry_run" == 0 ]] && [[ "${CODER_GPG_RELEASE_KEY_BASE64:-}" != "" ]]; the
129129
log "--- Signing checksums file"
130130
log
131131

132-
# Import the GPG key.
133-
old_gnupg_home="${GNUPGHOME:-}"
134-
gnupg_home_temp="$(mktemp -d)"
135-
export GNUPGHOME="$gnupg_home_temp"
136-
echo "$CODER_GPG_RELEASE_KEY_BASE64" | base64 -d | gpg --import 1>&2
137-
138-
# Sign the checksums file. This generates a file in the same directory and
139-
# with the same name as the checksums file but ending in ".asc".
140-
#
141-
# We pipe `true` into `gpg` so that it never tries to be interactive (i.e.
142-
# ask for a passphrase). The key we import above is not password protected.
143-
true | gpg --detach-sign --armor "${temp_dir}/${checksum_file}" 1>&2
144-
145-
rm -rf "$gnupg_home_temp"
146-
unset GNUPGHOME
147-
if [[ "$old_gnupg_home" != "" ]]; then
148-
export GNUPGHOME="$old_gnupg_home"
149-
fi
150-
132+
execrelative ../sign_with_gpg.sh "${temp_dir}/${checksum_file}"
151133
signed_checksum_path="${temp_dir}/${checksum_file}.asc"
134+
152135
if [[ ! -e "$signed_checksum_path" ]]; then
153136
log "Signed checksum file not found: ${signed_checksum_path}"
154137
log

scripts/sign_with_gpg.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# Usage: ./sign_with_gpg.sh path/to/binary
77
#
8-
# On success, the input file will be signed using the GPG key.
8+
# On success, the input file will be signed using the GPG key and the signature output file will moved to /site/out/bin/ (happens in the Makefile)
99
#
1010
# Depends on the GPG utility. Requires the following environment variables to be set:
1111
# - $CODER_GPG_RELEASE_KEY_BASE64: The base64 encoded private key to use.
@@ -20,12 +20,10 @@ FILE_TO_SIGN="$1"
2020

2121
if [[ -z "$FILE_TO_SIGN" ]]; then
2222
echo "Usage: $0 <file_to_sign>"
23-
exit 1
2423
fi
2524

2625
if [[ ! -f "$FILE_TO_SIGN" ]]; then
2726
echo "File not found: $FILE_TO_SIGN"
28-
exit 1
2927
fi
3028

3129
# Import the GPG key.
@@ -58,5 +56,4 @@ if [[ $verification_result -eq 0 ]]; then
5856
echo "${FILE_TO_SIGN}.asc"
5957
else
6058
echo "Signature verification failed!" >&2
61-
exit 1
6259
fi

0 commit comments

Comments
 (0)