ghcup-hs/scripts/releasing/pull_release_artifacts.sh

38 lines
909 B
Bash
Raw Normal View History

2023-01-13 04:07:32 +00:00
#!/bin/bash
2022-02-26 17:06:41 +00:00
set -eu
2023-01-13 04:07:32 +00:00
set -o pipefail
2022-02-26 17:06:41 +00:00
2023-01-13 04:07:32 +00:00
shopt -s extglob
2022-02-26 17:06:41 +00:00
2023-01-13 04:07:32 +00:00
RELEASE=$1
SIGNER=$2
2023-02-24 11:52:41 +00:00
TAG=${RELEASE/v/}
2022-02-26 17:06:41 +00:00
2023-01-13 04:07:32 +00:00
echo "RELEASE: $RELEASE"
echo "SIGNER: $SIGNER"
2022-02-26 17:06:41 +00:00
2023-01-13 04:07:32 +00:00
for com in gh gpg curl sha256sum ; do
command -V ${com} >/dev/null 2>&1
done
2022-02-26 17:06:41 +00:00
2023-01-13 04:07:32 +00:00
[ ! -e "gh-release-artifacts/${RELEASE}" ]
2022-02-26 17:06:41 +00:00
2023-01-13 04:07:32 +00:00
mkdir -p "gh-release-artifacts/${RELEASE}"
2023-02-19 15:58:25 +00:00
2023-02-24 11:52:41 +00:00
git archive --format=tar.gz -o "gh-release-artifacts/${RELEASE}/ghcup-${TAG}-src.tar.gz" --prefix="ghcup-${TAG}/" HEAD
2023-02-19 15:58:25 +00:00
2023-01-13 04:07:32 +00:00
cd "gh-release-artifacts/${RELEASE}"
2022-02-26 17:06:41 +00:00
2023-01-13 04:07:32 +00:00
# github
2023-02-19 15:58:25 +00:00
gh release download "$RELEASE"
2022-02-26 17:06:41 +00:00
2023-01-13 04:07:32 +00:00
# cirrus
2023-02-24 11:52:41 +00:00
curl -L -o "x86_64-portbld-freebsd-ghcup-${TAG}" \
2023-07-12 09:51:56 +00:00
"https://api.cirrus-ci.com/v1/artifact/github/haskell/ghcup-hs/build/binaries/out/x86_64-portbld-freebsd-ghcup-${TAG}?branch=${RELEASE}"
2022-02-26 17:06:41 +00:00
2023-02-19 15:58:25 +00:00
sha256sum ./*-ghcup-* > SHA256SUMS
2023-01-13 04:07:32 +00:00
gpg --detach-sign -u "${SIGNER}" SHA256SUMS
2022-02-26 17:06:41 +00:00
2023-02-24 11:52:41 +00:00
gh release upload "$RELEASE" "ghcup-${TAG}-src.tar.gz" "x86_64-portbld-freebsd-ghcup-${TAG}" SHA256SUMS SHA256SUMS.sig