shrub/sh/cachix

37 lines
657 B
Bash
Executable File

#!/usr/bin/env bash
fail () {
echo "$@"
if [ "$TRAVIS_PULL_REQUEST" = false ]
then exit 1
else exit 0
fi
}
if [ -z "$CACHIX_SIGNING_KEY" ]
then fail "The CACHIX_SIGNING_KEY environment variable needs to be set."
fi
if [ -z "$CACHIX_AUTH_TOKEN" ]
then fail "The CACHIX_AUTH_TOKEN environment variable needs to be set."
fi
cleanup () {
rm -f .cache.list
}
trap cleanup EXIT
set -ex
cachix authtoken "$CACHIX_AUTH_TOKEN" >/dev/null
cachix use urbit2
nix-build --no-out-link \
--max-jobs 2 \
nix/cachix/local.nix \
nix/cachix/release.nix \
> .cache.list
cachix push urbit2 < .cache.list