diff --git a/automated/build-next.sh b/automated/build-next.sh new file mode 100755 index 00000000..fd51f430 --- /dev/null +++ b/automated/build-next.sh @@ -0,0 +1,150 @@ +#!/usr/bin/env bash + +set -eu +x + +ROOT=$(cd $(dirname $0) ; pwd) +TARGET=$1 + +# For nightly-YYYY-MM-DD, tag should be nightly +# For lts-X.Y, tag should be ltsX +SHORTNAME=$(echo $TARGET | cut -d- -f 1) +if [ $SHORTNAME = "lts" ] +then + TAG=$(echo $TARGET | sed 's@^lts-\([0-9]*\)\.[0-9]*@lts\1@') +else + TAG=$SHORTNAME +fi + +IMAGE=commercialhaskell/stackage:$TAG + +CABAL_DIR=$ROOT/cabal +STACK_DIR=$ROOT/stack +GHC_DIR=$ROOT/ghc +DOT_STACKAGE_DIR=$ROOT/dot-stackage +WORKDIR=$ROOT/$TAG/work +# ssh key is used for committing snapshots (and their constraints) to Github +SSH_DIR=$ROOT/ssh +USERID=$(id -u) + +mkdir -p \ + "$CABAL_DIR" \ + "$STACK_DIR" \ + "$GHC_DIR" \ + "$DOT_STACKAGE_DIR" \ + "$WORKDIR" \ + "$SSH_DIR" + +GITCONFIG=$ROOT/gitconfig +cat >$GITCONFIG <