Files
runner-images/images/macos/provision/core/stack.sh
Mikhail Timofeev cdd8150e00 [macOS] Allow using GitHub PAT to enlarge api requests limit (#4917)
* Use gh api pat

* Add gh token to 10.15

* Add github_api_pat for macos-12
2022-01-20 13:41:21 +03:00

26 lines
901 B
Bash

#!/bin/bash -e -o pipefail
source ~/utils/utils.sh
echo "Get the latest Stack version..."
StackRelease=$(curl -H "Authorization: token $API_PAT" -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..."
download_with_retries $DownloadUrl "/tmp" "stack.tar.gz"
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"
invoke_tests "Common" "Stack"