Skip to content

Commit

Permalink
add upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Reichenberger committed Jul 30, 2020
1 parent 5a091be commit e2ea461
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
4 changes: 0 additions & 4 deletions bin/.gitignore

This file was deleted.

33 changes: 33 additions & 0 deletions bin/upload
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
TAG=$1

function usage {
echo "Usage: upload VERSION"
}

function upload {
FILE=$1
RELEASE_NUMBER=$2

curl \
-H "Authorization: token ${GH_TOKEN}" \
-H "Content-Type: $(file -b --mime-type ${FILE})" \
--data-binary @${FILE} \
"https://uploads.github.com/repos/paperspace/terraform-provider-paperspace/releases/${RELEASE_NUMBER}/assets?name=$(basename ${FILE})"
}

if [ -z "${TAG}" ];then
usage
exit 1
fi

RELEASE_NUMBER=$(curl \
-H "Authorization: token ${GH_TOKEN}" \
"https://api.github.com/repos/paperspace/terraform-provider-paperspace/releases/tags/${TAG}" | jq '.id')

upload ${DIR}/../build/terraform-provider-paperspace-darwin-amd64 ${RELEASE_NUMBER}
upload ${DIR}/../build/terraform-provider-paperspace-linux-amd64 ${RELEASE_NUMBER}
upload ${DIR}/../build/terraform-provider-paperspace-windows-amd64.exe ${RELEASE_NUMBER}

0 comments on commit e2ea461

Please sign in to comment.