Skip to content

Commit 224d93b

Browse files
committed
release.sh: replace with script that triggers CI
1 parent 50e541e commit 224d93b

2 files changed

Lines changed: 62 additions & 22 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ xbps-cachedir*
99
stamps*
1010
!dracut/*/*.sh
1111
!packer/scripts/*.sh
12+
void-live-*/
13+
release/

release.sh

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,68 @@
11
#!/bin/bash
22

3-
XBPS_REPOSITORY="-r /hostdir/binpkgs -r /hostdir/binpkgs/musl -r /hostdir/binpkgs/aarch64"
4-
DATECODE=$(date "+%Y%m%d")
3+
set -e
54

6-
ARCHS="$(echo x86_64{,-musl} i686 armv{6,7}l{,-musl} aarch64{,-musl})"
7-
PLATFORMS="$(echo rpi-{armv{6,7}l,aarch64}{,-musl})"
8-
SBC_IMGS="$(echo rpi-{armv{6,7}l,aarch64}{,-musl})"
5+
usage() {
6+
echo "release.sh start [-l LIVE_ARCHS] [-f LIVE_VARIANTS] [-a ROOTFS_ARCHS]"
7+
echo " [-p PLATFORMS] [-i SBC_IMGS] [-d DATE] [-r REPOSITORY] -- [gh args...]"
8+
echo "release.sh dl [gh args...]"
9+
echo "release.sh sign DATE SHASUMFILE"
10+
exit 1
11+
}
912

10-
make rootfs-all ARCHS="$ARCHS" XBPS_REPOSITORY="$XBPS_REPOSITORY" DATECODE="$DATECODE"
11-
make platformfs-all PLATFORMS="$PLATFORMS" XBPS_REPOSITORY="$XBPS_REPOSITORY" DATECODE="$DATECODE"
12-
make images-all-sbc SBC_IMGS="$SBC_IMGS" XBPS_REPOSITORY="$XBPS_REPOSITORY" DATECODE="$DATECODE"
13+
check_programs() {
14+
for prog; do
15+
if ! type $prog &>/dev/null; then
16+
echo "missing program: $prog"
17+
exit 1
18+
fi
19+
done
20+
}
1321

14-
MKLIVE_REPO=(-r /hostdir/binpkgs -r /hostdir/binpkgs/nonfree -r /hostdir/musl -r /hostdir/binpkgs/musl/nonfree)
15-
./build-x86-images.sh -a i686 -b base "${MKLIVE_REPO[@]}"
16-
./build-x86-images.sh -a i686 -b xfce "${MKLIVE_REPO[@]}"
22+
start_build() {
23+
check_programs gh
24+
ARGS=()
25+
while getopts "a:d:f:i:l:p:r:" opt; do
26+
case $opt in
27+
a) ARGS+=(-f rootfs="$OPTARG") ;;
28+
d) ARGS+=(-f datecode="$OPTARG") ;;
29+
f) ARGS+=(-f live_flavors="$OPTARG") ;;
30+
i) ARGS+=(-f sbc_imgs="$OPTARG") ;;
31+
l) ARGS+=(-f live_archs="$OPTARG") ;;
32+
p) ARGS+=(-f platformfs="$OPTARG") ;;
33+
r) ARGS+=(-f mirror="$OPTARG") ;;
34+
?) usage;;
35+
esac
36+
done
37+
shift $((OPTIND - 1))
38+
gh workflow run gen-images.yml "${ARGS[@]}" "$@"
39+
}
1740

18-
./build-x86-images.sh -a x86_64 -b base "${MKLIVE_REPO[@]}"
19-
./build-x86-images.sh -a x86_64 -b xfce "${MKLIVE_REPO[@]}"
41+
# this assumes that the latest successful build is the one to download
42+
# wish it could be better but alas:
43+
# https://github.com/cli/cli/issues/4001
44+
download_build() {
45+
check_programs gh
46+
run="$(gh run list -s success -w gen-images.yml --json databaseId -q '.[].databaseId' "$@" | sort -r | head -1)"
47+
echo "Downloading artifacts from run ${run} [this may take a while] ..."
48+
gh run download "$run" -p 'void-live*' "$@"
49+
echo "Done."
50+
}
2051

21-
./build-x86-images.sh -a x86_64-musl -b base "${MKLIVE_REPO[@]}"
22-
./build-x86-images.sh -a x86_64-musl -b xfce "${MKLIVE_REPO[@]}"
52+
sign_build() {
53+
check_programs pwgen signify
54+
DATE="$1"
55+
SUMFILE="$2"
56+
mkdir -p release
57+
KEYFILE="release/void-release-$DATE.key"
58+
pwgen -cny 25 1 > "$KEYFILE"
59+
signify -G -p "${KEYFILE//key/pub}" -s "${KEYFILE//key/sec}" -c "This key is only valid for images with date $DATE."
60+
signify -S -e -s "${KEYFILE//key/sec}" -m "$SUMFILE" -x "${SUMFILE//txt/sig}"
61+
}
2362

24-
mkdir "$DATECODE"
25-
mv "*${DATECODE}*.xz" "$DATECODE/"
26-
mv "*${DATECODE}*.gz" "$DATECODE/"
27-
mv "*${DATECODE}*.iso" "$DATECODE/"
28-
29-
cd "$DATECODE" || exit 1
30-
sha256sum --tag -- * > sha256sums.txt
63+
case "$1" in
64+
st*) shift; start_build "$@" ;;
65+
d*) shift; download_build "$@" ;;
66+
si*) shift; sign_build "$@" ;;
67+
*) usage ;;
68+
esac

0 commit comments

Comments
 (0)