release: Add stable branch to release.sh (#2236)

* Add stable branch to release.sh

To be used in PPA builds.

* do not update stable branch if prerelease

---------

Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
This commit is contained in:
Anton Soroko 2024-01-31 16:25:07 +03:00 committed by GitHub
parent c4a64f3ade
commit 5392eebaef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -43,6 +43,8 @@ prerelease=false
echo $version | grep '.*rc.*' >/dev/null
[ $? -eq 0 ] && prerelease=true
stable_branch=stable
ref=$(git symbolic-ref HEAD)
[ $? -ne 0 ] && echo 'Error: Failed current branch' && exit 1
branch=${ref##*/}
@ -133,6 +135,20 @@ echo 'Pushing tag...'
[ -z "$DRY_RUN" ] && git push $remote $version >/dev/null || true
[ $? -ne 0 ] && echo -e '\nError: Failed to push tag' && exit 1
# Point stable branch to latest version tag
echo 'Updating stable branch...'
if [[ -z "$DRY_RUN" && $prerelease == "false" ]]
then
# Check if stable branch does not exist
git rev-list --max-count=1 $stable_branch >/dev/null 2>/dev/null
[ $? -ne 0 ] && echo -e '\nWarning: Creating stable branch for a first time' && git branch $stable_branch
# Fast forward and push stable branch
git checkout $stable_branch
git merge --ff $version
git push $remote $stable_branch >/dev/null || true
git checkout $branch
fi
# Create github release
body() {
cat <<EOF