vscodium/release.sh

53 lines
1 KiB
Bash
Raw Normal View History

2021-10-01 12:47:10 -04:00
#!/bin/bash
set -e
if [[ -z "${GH_CLI_TOKEN}" ]]; then
echo "Will not release because no GH_CLI_TOKEN defined"
exit
fi
2021-11-10 03:36:35 -05:00
gh --version
2021-10-01 12:47:10 -04:00
echo "${GH_CLI_TOKEN}" | gh auth login --with-token
if [[ $( gh release view "${MS_TAG}" 2>&1 ) =~ "release not found" ]]; then
echo "Creating release '${MS_TAG}'"
gh release create "${MS_TAG}"
fi
cd artifacts
2021-11-06 07:26:36 -04:00
set +e
2021-10-01 12:47:10 -04:00
for FILE in *
do
if [[ -f "${FILE}" ]] && [[ "${FILE}" != *.sha1 ]] && [[ "${FILE}" != *.sha256 ]]; then
2021-11-10 03:36:35 -05:00
echo "Uploading '${FILE}' at $( date )"
2021-10-01 12:47:10 -04:00
gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
2021-11-06 07:03:44 -04:00
2021-11-10 03:36:35 -05:00
if ! (( $? )); then
for (( i=0; i<10; i++ ))
2021-11-06 07:03:44 -04:00
do
sleep $(( 15 * (i + 1)))
2021-11-10 03:36:35 -05:00
echo "RE-Uploading '${FILE}' at $( date )"
gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256" --clobber
2021-11-10 03:36:35 -05:00
echo "exit: $?"
2021-11-06 07:03:44 -04:00
2021-11-10 03:36:35 -05:00
if ! (( $? )); then
2021-11-06 07:03:44 -04:00
break
fi
done
2021-11-10 03:36:35 -05:00
echo "exit: $?"
2021-11-10 03:36:35 -05:00
if (( $? )); then
echo "'${FILE}' hasn't been uploaded!"
exit 1
fi
2021-11-06 07:03:44 -04:00
fi
2021-10-01 12:47:10 -04:00
fi
done
cd ..