Files
runner-images/images/macos/provision/core/stack.sh
Mikhail Timofeev 0d46520ccf [macOS] Fail builds on errors during the image generation (#1756)
* set -e and fix all the scripts

* add source utils to finalize_vm script

* change xcode version in postbuild script

* fix for softwareupdates and for xcode version
2020-10-23 17:59:08 +03:00

23 lines
789 B
Bash

#!/bin/bash -e -o pipefail
echo "Get the latest Stack version..."
StackRelease=$(curl -s "https://api.github.com/repos/commercialhaskell/stack/releases/latest")
DownloadUrl=$(echo $StackRelease | jq -r '.assets[].browser_download_url | select(contains("osx-x86_64.tar.gz"))' | head -n 1)
StackVersion=$(echo $StackRelease | jq -r '.name' | cut -c2-)
StackArchive="/tmp/stack.tar.gz"
echo "Download stack version $StackVersion..."
wget $DownloadUrl -O $StackArchive
StackToolcachePath="$AGENT_TOOLSDIRECTORY/stack/$StackVersion"
DestinationPath="$StackToolcachePath/x64"
mkdir -p $DestinationPath
echo "Unzip stack archive..."
tar -xzf $StackArchive -C $DestinationPath --strip 1
touch $StackToolcachePath/x64.complete
echo "export PATH="\$PATH":$DestinationPath" >> "$HOME/.bashrc"