Skip to content

Instantly share code, notes, and snippets.

@nickzelei
Last active May 14, 2020 16:11
Show Gist options
  • Select an option

  • Save nickzelei/c9e8c2bf2383a395af8bc262cc9a95bd to your computer and use it in GitHub Desktop.

Select an option

Save nickzelei/c9e8c2bf2383a395af8bc262cc9a95bd to your computer and use it in GitHub Desktop.
Create a Github Release at the current package.json version
#!/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