Common release scripts

This commit is contained in:
Ask Bjørn Hansen 2023-07-08 17:39:36 -07:00
parent 5c067e3752
commit facd2f4f57
4 changed files with 72 additions and 0 deletions

12
scripts/Makefile Normal file
View File

@ -0,0 +1,12 @@
all: Makefile scripts
Makefile: .PHONY
cp ~/src/go/common/scripts/Makefile .
scripts: .PHONY
cp ~/src/go/common/scripts/{fury-publish,run-goreleaser,download-release} .
.PHONY:

32
scripts/download-release Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
BASE=$1
BUILD=$2
DIR=$3
set -euo pipefail
if [ -z "$DIR" ]; then
echo run with $0 NAME BUILD_NUMBER DIR
exit 2
fi
mkdir -p $DIR
BASE=https://geodns.bitnames.com/${BASE}/builds/${BUILD}
files=`curl -sSf ${BASE}/checksums.txt | awk '{print $2}'`
metafiles="checksums.txt metadata.json CHANGELOG.md artifacts.json"
for f in $metafiles; do
url=$BASE/$f
echo downloading $url
curl --remove-on-error -sSfRo $DIR/$f $url || true
done
for f in $files; do
url=$BASE/$f
echo downloading $url
curl --remove-on-error -sSfRo $DIR/$f $url
done

15
scripts/fury-publish Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
account=$1
set -euo pipefail
if [ -z "$account" ]; then
echo specify account as the first parameter
exit 2
fi
for f in dist/*.rpm dist/*.deb; do
echo Uploading $f
curl -sf -F package=@$f https://${FURY_TOKEN}@push.fury.io/${account}/
done

13
scripts/run-goreleaser Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail
DRONE_TAG=${DRONE_TAG-""}
is_snapshot=""
if [ -z "$DRONE_TAG" ]; then
is_snapshot="--snapshot"
fi
goreleaser release $is_snapshot -p 6 --skip-publish