ghcup-hs/scripts/releasing/pull_release_artifacts.sh

37 lines
915 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
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
git archive --format=tar.gz -o "gh-release-artifacts/${RELEASE}/ghcup-${RELEASE}-src.tar.gz" --prefix="ghcup-${RELEASE}/" HEAD
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-19 15:58:25 +00:00
curl -L -o "x86_64-portbld-freebsd-ghcup-${RELEASE}" \
2023-01-13 04:07:32 +00:00
"https://api.cirrus-ci.com/v1/artifact/github/haskell/ghcup-hs/build/binaries/out/x86_64-portbld-freebsd-ghcup-${RELEASE}?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-19 15:58:25 +00:00
gh release upload "$RELEASE" "ghcup-${RELEASE}-src.tar.gz" "x86_64-portbld-freebsd-ghcup-${RELEASE}" SHA256SUMS SHA256SUMS.sig