docker-nixpkgs/.travis.sh
zimbatm 6597ff1349
ci: fix Travis CI builds
* run the ./build after setting the NIX_PATH. Previously the images
  were always generate with the system channel. Oops!
* pin the outer shell version to nixos-19.09. skopeo broke in unstable.
  also we don't need to force the system here, technically this could
  run on macOS.
2020-02-09 16:23:27 +01:00

28 lines
795 B
Bash
Executable file

#!/usr/bin/env bash
#
# Travis CI specific build script
#
set -euo pipefail
# default to Docker Hub
# the user has to set REGISTRY_USER and REGISTRY_PASSWORD
: "${REGISTRY:=docker.io}"
: "${IMAGE_PREFIX:=nixpkgs}"
# either set NIX_PATH and IMAGE_TAG, or set NIXPKGS_CHANNEL
if [[ -n "${NIXPKGS_CHANNEL:-}" ]]; then
: "${IMAGE_TAG:=$NIXPKGS_CHANNEL}"
export NIX_PATH=nixpkgs=channel:$NIXPKGS_CHANNEL
fi
./build
if [[ "$TRAVIS_BRANCH" = master && -z "${TRAVIS_PULL_REQUEST_BRANCH:-}" ]]; then
./docker-login "$REGISTRY_USER" "$REGISTRY_PASSWORD" "$REGISTRY"
./push-all "$REGISTRY" "$IMAGE_PREFIX" "$IMAGE_TAG"
if [[ $REGISTRY = *docker.io ]]; then
./dockerhub-metadata "$REGISTRY_USER" "$REGISTRY_PASSWORD" "$IMAGE_PREFIX"
fi
else
echo "=== not pushing on non-master ==="
fi