From 934304c17d57f87da0fedfb933efb77f95b2aaec Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 17 Mar 2016 11:49:48 -0700 Subject: [PATCH] Add download script to obtain PowerShell release This requires that $GITHUB_TOKEN be set. Travis sets this as a secure environment variable; a user can provider their own. --- download.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 download.sh diff --git a/download.sh b/download.sh new file mode 100755 index 0000000000..58ef8d0e0e --- /dev/null +++ b/download.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +[[ -n $GITHUB_TOKEN ]] || { echo >&2 "GITHUB_TOKEN variable is undefined, please provide token"; exit 1; } + +# Authorizes with read-only access to GitHub API +# Retrieves URL of v0.2.0 release asset +# Downloads asset to powershell.deb +curl -s -i \ + -H "Authorization: token $GITHUB_TOKEN " \ + -H 'Accept: application/octet-stream' \ + 'https://api.github.com/repos/PowerShell/PowerShell/releases/assets/1398546' | + grep location | + sed 's/location: //g' | + wget -i - -O powershell.deb