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
This commit is contained in:
Simone Basso 2022-08-30 15:29:09 +02:00 committed by GitHub
commit d10ab88444
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 111 additions and 151 deletions

25
script/ghpublish.bash Executable file
View file

@ -0,0 +1,25 @@
#!/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 "$@"

28
script/maketarball.bash Executable file
View file

@ -0,0 +1,28 @@
#!/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
__version=${__ref#refs/tags/v}
else
__version=rolling
fi
set -x
# 3. make sure we're using the correct go version
./CLI/check-go-version
# 4. generate the actual tarball
go mod vendor
tar -czf ooni-probe-cli-${__version}.tar.gz --transform "s,^,ooni-probe-cli-${__version}/," *