Last active
May 14, 2020 16:11
-
-
Save nickzelei/c9e8c2bf2383a395af8bc262cc9a95bd to your computer and use it in GitHub Desktop.
Create a Github Release at the current package.json version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # https://gist.github.com/DarrenN/8c6a5b969481725a4413 | |
| # Modified to trim spaces | |
| PACKAGE_VERSION=$(cat package.json \ | |
| | grep version \ | |
| | head -1 \ | |
| | awk -F: '{ print $2 }' \ | |
| | sed 's/[ ",]//g') | |
| RELEASE_NAME="v$PACKAGE_VERSION" | |
| POST_BODY="{\"tag_name\":\"$RELEASE_NAME\",\"target_commitish\":\"master\",\"name\":\"$RELEASE_NAME\",\"body\":\"\",\"prerelease\":false,\"draft\":false}" | |
| curl -f -H "Authorization: token $GITHUB_PERSONAL_ACCESS_TOKEN" -H "Content-Type: application/json" -d $POST_BODY -X POST https://api.github.com/repos/$OWNER/$REPO/releases |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment