2021-10-01 12:47:10 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-11-10 04:13:12 -05:00
|
|
|
if [[ -z "${GITHUB_TOKEN}" ]]; then
|
|
|
|
echo "Will not release because no GITHUB_TOKEN defined"
|
2021-10-01 12:47:10 -04:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-10 04:13:12 -05:00
|
|
|
npm install -g github-release-cli
|
2021-10-01 12:47:10 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-03-04 03:16:49 -05:00
|
|
|
OWNER="${GITHUB_REPOSITORY_OWNER:-"VSCodium"}"
|
|
|
|
REPO_NAME="${GITHUB_REPOSITORY:(${#OWNER}+1)}"
|
|
|
|
REPOSITORY="${REPO_NAME:-"vscodium"}"
|
|
|
|
|
2022-05-07 07:51:07 -04:00
|
|
|
# git workaround
|
|
|
|
git config --global --add safe.directory /__w/vscodium/vscodium
|
|
|
|
|
|
|
|
|
2021-10-01 12:47:10 -04:00
|
|
|
for FILE in *
|
|
|
|
do
|
|
|
|
if [[ -f "${FILE}" ]] && [[ "${FILE}" != *.sha1 ]] && [[ "${FILE}" != *.sha256 ]]; then
|
2021-11-11 20:14:13 -05:00
|
|
|
echo "::group::Uploading '${FILE}' at $( date "+%T" )"
|
2021-11-10 04:40:20 -05:00
|
|
|
gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
|
2021-11-06 07:03:44 -04:00
|
|
|
|
2021-11-10 05:52:44 -05:00
|
|
|
EXIT_STATUS=$?
|
|
|
|
echo "exit: $EXIT_STATUS"
|
|
|
|
|
2021-11-11 20:14:13 -05:00
|
|
|
if (( $EXIT_STATUS )); then
|
2021-11-06 07:58:53 -04:00
|
|
|
for (( i=0; i<10; i++ ))
|
2021-11-06 07:03:44 -04:00
|
|
|
do
|
2022-03-04 02:30:33 -05:00
|
|
|
github-release delete --owner "${OWNER}" --repo "${REPOSITORY}" --tag "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
|
2021-11-10 04:13:12 -05:00
|
|
|
|
2021-11-06 07:58:53 -04:00
|
|
|
sleep $(( 15 * (i + 1)))
|
|
|
|
|
2021-11-10 04:13:12 -05:00
|
|
|
echo "RE-Uploading '${FILE}' at $( date "+%T" )"
|
2021-11-10 04:40:20 -05:00
|
|
|
gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
|
|
|
|
|
|
|
|
EXIT_STATUS=$?
|
2021-11-10 04:13:12 -05:00
|
|
|
echo "exit: $EXIT_STATUS"
|
2021-11-06 07:03:44 -04:00
|
|
|
|
2021-11-10 04:13:12 -05:00
|
|
|
if ! (( $EXIT_STATUS )); then
|
2021-11-06 07:03:44 -04:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2021-11-10 04:13:12 -05:00
|
|
|
echo "exit: $EXIT_STATUS"
|
2021-11-06 07:58:53 -04:00
|
|
|
|
2021-11-10 04:13:12 -05:00
|
|
|
if (( $EXIT_STATUS )); then
|
2021-11-06 07:58:53 -04:00
|
|
|
echo "'${FILE}' hasn't been uploaded!"
|
2021-11-10 04:13:12 -05:00
|
|
|
|
2022-03-04 02:30:33 -05:00
|
|
|
github-release delete --owner "${OWNER}" --repo "${REPOSITORY}" --tag "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
|
2021-11-10 04:13:12 -05:00
|
|
|
|
2021-11-06 07:58:53 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-11-06 07:03:44 -04:00
|
|
|
fi
|
2021-11-11 20:14:13 -05:00
|
|
|
|
|
|
|
echo "::endgroup::"
|
2021-10-01 12:47:10 -04:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
cd ..
|