Last active
November 26, 2020 20:39
-
-
Save gWOLF3/dbe7a81c9ed6ffa99dfadee5595be1f0 to your computer and use it in GitHub Desktop.
create release from command line
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/bash | |
# script credit: github user @dodotree | |
version=$1 | |
text=$2 | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
repo_full_name=$(git config --get remote.origin.url | sed 's/.*:\/\/github.com\///;s/.git$//') | |
token=$(git config --global github.token) | |
generate_post_data() | |
{ | |
cat <<EOF | |
{ | |
"tag_name": "$version", | |
"target_commitish": "$branch", | |
"name": "$version", | |
"body": "$text", | |
"draft": false, | |
"prerelease": false | |
} | |
EOF | |
} | |
echo "Create release $version for repo: $repo_full_name branch: $branch" | |
curl --data "$(generate_post_data)" "https://api.github.com/repos/$repo_full_name/releases?access_token=$token" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment