fix: deleting bad assets (#913)

This commit is contained in:
Baptiste Augrain 2021-11-10 10:13:12 +01:00 committed by GitHub
parent 848aabfe54
commit cf48030b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 15 deletions

View File

@ -88,7 +88,7 @@ jobs:
- name: Release
env:
GH_CLI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./release.sh
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

View File

@ -2,14 +2,12 @@
set -e
if [[ -z "${GH_CLI_TOKEN}" ]]; then
echo "Will not release because no GH_CLI_TOKEN defined"
if [[ -z "${GITHUB_TOKEN}" ]]; then
echo "Will not release because no GITHUB_TOKEN defined"
exit
fi
gh --version
echo "${GH_CLI_TOKEN}" | gh auth login --with-token
npm install -g github-release-cli
if [[ $( gh release view "${MS_TAG}" 2>&1 ) =~ "release not found" ]]; then
echo "Creating release '${MS_TAG}'"
@ -23,26 +21,31 @@ set +e
for FILE in *
do
if [[ -f "${FILE}" ]] && [[ "${FILE}" != *.sha1 ]] && [[ "${FILE}" != *.sha256 ]]; then
echo "Uploading '${FILE}' at $( date )"
gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
echo "Uploading '${FILE}' at $( date "+%T" )"
EXIT_STATUS=$( gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256" )
if ! (( $? )); then
if ! (( $EXIT_STATUS )); then
for (( i=0; i<10; i++ ))
do
github-release delete --owner VSCodium --repo vscodium --tag "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
sleep $(( 15 * (i + 1)))
echo "RE-Uploading '${FILE}' at $( date )"
gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256" --clobber
echo "exit: $?"
echo "RE-Uploading '${FILE}' at $( date "+%T" )"
EXIT_STATUS=$( gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256" )
echo "exit: $EXIT_STATUS"
if ! (( $? )); then
if ! (( $EXIT_STATUS )); then
break
fi
done
echo "exit: $?"
echo "exit: $EXIT_STATUS"
if (( $? )); then
if (( $EXIT_STATUS )); then
echo "'${FILE}' hasn't been uploaded!"
github-release delete --owner VSCodium --repo vscodium --tag "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
exit 1
fi
fi