Skip to content

Commit

Permalink
chore(github releases): script to change the draft status of a github…
Browse files Browse the repository at this point in the history
… release to false

given 2 env vars RELEASE_ID and GH_TOKEN, this script will rename the release to a name based on the
date, and release it (change draft status to false)
  • Loading branch information
fczuardi committed Jun 21, 2018
1 parent d5e6547 commit 143b336
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bin/github_publish_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

if [ -z "$GH_TOKEN" ]; then
echo "Missing Github token";
exit 1;
fi

if [ -z "$RELEASE_ID" ]; then
echo "Missing release ID";
exit 1;
fi

DRAFT_STATUS="false"
RELEASE_NAME=$(date '+%Y-%m-%d.%H%M')

curl "https://api.github.com/repos/CraveFood/farmblocks/releases/$RELEASE_ID" \
-H "Accept: application/vnd.github.v3+json"\
-H "Authorization: token $GH_TOKEN"\
-X PATCH \
--data "{\"name\": \"$RELEASE_NAME\", \"tag_name\": \"$RELEASE_NAME\", \"draft\": $DRAFT_STATUS}"

0 comments on commit 143b336

Please sign in to comment.