Automate creating GitHub release

Creating a release draft, so that I can manually add release notes.
This commit is contained in:
Klaus Hartl 2023-02-19 12:46:50 +01:00
parent 94f83dd582
commit b4df355506
No known key found for this signature in database
GPG key ID: 6BA8AED91AB6EA2A

11
run.sh
View file

@ -6,10 +6,6 @@ _user() {
printf "\033[0;33m%s\033[0m" "$1" printf "\033[0;33m%s\033[0m" "$1"
} }
_success() {
printf "\033[0;32m==> %s\033[0m\n\n" "$1"
}
_fail() { _fail() {
printf "\033[0;31m==> %s\033[0m\n\n" "$1" printf "\033[0;31m==> %s\033[0m\n\n" "$1"
} }
@ -22,7 +18,7 @@ prep_release() {
grep -rlZE 'v\d+\.\d+\.\d+' --exclude=Dockerfile --exclude-dir=.git . | xargs sed -i '' 's/v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"$1"'/g' grep -rlZE 'v\d+\.\d+\.\d+' --exclude=Dockerfile --exclude-dir=.git . | xargs sed -i '' 's/v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"$1"'/g'
_user "Push? " _user "Prepare release draft on GitHub? "
read -r answer read -r answer
if [ "$answer" = "y" ]; then if [ "$answer" = "y" ]; then
git add --update git add --update
@ -30,7 +26,8 @@ prep_release() {
git push origin main git push origin main
git tag -s "$1" -m "Release $1" git tag -s "$1" -m "Release $1"
git push --tags git push --tags
_success "Tag for release $1 available!" gh release create --draft --latest --title "$1" --verify-tag
gh release view "$1" --web
fi fi
} }
@ -38,7 +35,7 @@ _help() {
echo "Usage: ./run.sh [command]" echo "Usage: ./run.sh [command]"
echo "" echo ""
echo "Available commands:" echo "Available commands:"
echo "prep-release <version> Prepare new release" echo "prep-release <version> Prepare new release draft"
} }
cmd="${1:-}" cmd="${1:-}"