1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/bin/sh
set -e
if [ -z "$1" ] || [ "$1" = --help ]; then
cat <<'EOF' 1>&2
Upload a release tarball to the Charliecloud packages repository using wget(1).
Usage:
$ misc/tar-upload.sh VERSION
EOF
exit 1
fi
version=$1
echo "version: $version"
tarball=charliecloud-$version.tar.gz
echo "tarball: $tarball"
if ! [ -f "$tarball" ]; then
echo "tarball does not exist" 1>&2
exit 1
fi
printf 'GitLab PAT (not echoed)> '
stty_bak=$(stty -g)
stty -echo echonl
read -r pat
stty "$stty_bak"
url="https://gitlab.com/api/v4/projects/62049685/packages/generic/tar/${version}/charliecloud-${version}.tar.gz"
echo "PUTting: $url"
wget --method=PUT \
--header='Content-Type: application/octet-stream' \
--header="PRIVATE-TOKEN: $pat" \
--body-file="$tarball" \
"$url"
|