citron-nightly/run.sh

36 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Build a nightly using the helper Docker container.
set -euo pipefail
IMAGE="git.rgst.io/jaredallard/citron-nightly-builder"
if [[ "$CI" != "true" ]]; then
docker buildx build -t "$IMAGE" --load .
else
docker pull "$IMAGE"
fi
container_id=$(docker run --rm --detach --init --volume "citron-nightly-src:/src/citron-nightly" "$IMAGE" sleep infinity)
trap 'docker stop ${container_id}' EXIT
echo "Using $container_id"
docker exec "$container_id" build-nightly.sh
rm -rf "builds"
mkdir -p "builds"
docker cp "$container_id:/root/builds/" "./builds/"
# TODO(jaredallard): Unsure why this is happening.
mv ./builds/builds/* ./builds/
rmdir builds/builds
sudo chown "$(id -u):$(id -g)" "./builds/"*
# upload the artifacts
appimage_path=$(basename "$(find "./builds" -maxdepth 1 -name "*.AppImage" -print | head -n 1)")
release_name="${appimage_path//citron-/}"
release_name="${release_name//.AppImage/}"
echo "Create release $release_name"
fj --host git.rgst.io release --repo jaredallard/citron-nightly create \
--create-tag --attach ./builds/"$appimage_path" "$release_name"