Quick setup to tag a GitHub (draft) release from the latest version tag.
Created
July 2, 2019 14:09
-
-
Save sebastiaanluca/083c0a9151b09155deb7303b022de316 to your computer and use it in GitHub Desktop.
This file contains 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
alias git-last-release='git describe --tags $(git rev-list --tags="[0-9]*.[0-9]*.[0-9]*" --max-count=1)' | |
confirm() { | |
# call with a prompt string or use a default | |
read -r -p "${1:-Are you sure? [y/N]} " response | |
case "$response" in | |
[yY][eE][sS]|[yY]) | |
true | |
;; | |
*) | |
false | |
;; | |
esac | |
} | |
git-release() { | |
echo "Preparing to release version $(git-last-release) of $(basename "$PWD")" | |
confirm \ | |
&& hub release create -m "$(git-last-release)" -m "See [CHANGELOG.md](CHANGELOG.md) for release notes." $(git-last-release) $1 \ | |
&& echo 'Release created!' \ | |
|| echo 'Cancelled release' | |
} | |
git-release-draft() { | |
git-release --draft | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment