ooni-probe-cli/script/ghpublish.bash
Simone Basso d10ab88444
feat: implement rolling builds (#910)
This diff modifies all the github actions that produce assets to
publish on a release called rolling when we are not building a tag.

If everything goes as planned, we should be able to provide
people with automatically generated fresh binaries for testing.

While there, introduce caching for all builds to make them
as fast as possible. I suspect gomobile based builds will not
see any speed up but other builds most likely will.

See https://github.com/ooni/probe/issues/2249
2022-08-30 15:29:09 +02:00

26 lines
571 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
# 1. obtain the github ref of this action run
__ref=${GITHUB_REF:-}
if [[ $__ref == "" ]]; then
echo "FATAL: missing github ref" 1>&2
exit 1
fi
# 2. determine whether to publish to a release or to rolling
if [[ $__ref =~ ^refs/tags/v ]]; then
__tag=${__ref#refs/tags/}
else
__tag=rolling
fi
set -x
# 3. create the release as a pre-release unless it already exists
gh release create -p $__tag --target $GITHUB_SHA || true
# 4. publish all the assets passed as arguments to the target release
gh release upload $__tag --clobber "$@"