ghcup-hs/scripts/releasing/pull_release_artifacts.sh

34 lines
672 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-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
2024-02-02 16:16:18 +00:00
gh release upload "$RELEASE" "ghcup-${TAG}-src.tar.gz" SHA256SUMS SHA256SUMS.sig