summaryrefslogtreecommitdiff
path: root/hack/upload-multiarch-release-assets.sh
blob: b3f8312dcf73db25d62976b94dc23ca7f001dc52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh

set -eu
set -o pipefail

if ! test -f VERSION; then
	echo "Error: VERSION file not found" >&2
    exit 1
fi

TARGET_VERSION="v$(cat VERSION)"

if ! test -d dist/release; then
    echo "Error: dist/release directory does not exist" >&2
    exit 1
fi

cd dist/release
rm -f release-${TARGET_VERSION}.sha256 release-${TARGET_VERSION}.sha256.asc
BINARIES=
echo "*** Generating SHA256 checksums for binaries"
for bin in argocd-image-updater-*; do
    sha256sum $bin >> release-${TARGET_VERSION}.sha256
    BINARIES="${BINARIES} $bin"
done

echo "*** Signing checksum file with GPG key"
gpg -a --detach-sign release-${TARGET_VERSION}.sha256

echo "*** Reverse verify signature"
gpg -a --verify release-${TARGET_VERSION}.sha256.asc

echo "*** Uploading release assets"
for asset in ${BINARIES} release-${TARGET_VERSION}.sha256 release-${TARGET_VERSION}.sha256.asc; do
    echo "     -> $asset"
    gh release upload ${TARGET_VERSION} ${asset}
done

echo "Done."