feat(ghpublish): choose (pre)release depending on tag (#928)

While there, include integration testing to make sure the script
is working as intended before using it.

While there, edit maketarball.bash's comments.
This commit is contained in:
Simone Basso 2022-09-03 12:11:19 +02:00 committed by GitHub
commit ae0613fbb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 72 additions and 6 deletions

View file

@ -16,10 +16,18 @@ else
__tag=rolling
fi
# 3. determine whether this is a pre-release
prerelease="-p"
if [[ $__tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
prerelease=""
fi
gh=${gh:-gh}
set -x
# 3. create the release as a pre-release unless it already exists
gh release create -p $__tag --target $GITHUB_SHA || true
# 4. create the release unless it already exists
$gh release create $prerelease $__tag --target $GITHUB_SHA || true
# 4. publish all the assets passed as arguments to the target release
gh release upload $__tag --clobber "$@"
# 5. publish all the assets passed as arguments to the target release
$gh release upload $__tag --clobber "$@"