passepartout-apple/scripts/merge-released-version.sh
Davide De Rosa 7ef32882f1
Freeze release workflow (#242)
* Freeze release workflow

- Do not pull anything from master

- Do not push release commit to master

- Only push created version tag

* Refine scripts to start new version

1. Cherry-pick hotfixes from released version

2. Bump version to new version

Normally, 1 is only made of the release commit updating CHANGELOG
with the release date.

However, if a release branch was needed to apply hotfixes to the
latest release, cherry picking will account for the whole release
branch (i.e. multiple commits).

* Ignore more paths for unit testing
2022-10-30 12:56:49 +01:00

28 lines
644 B
Bash
Executable File

#!/bin/bash
VERSION_PREV=$1
if [[ -z $VERSION_PREV ]]; then
echo "Released version number required"
exit 1
fi
RELEASE_BASE=`git merge-base master "v$VERSION_PREV" 2>>/dev/null`
if [[ $? != 0 ]]; then
echo "Version does not exist"
exit 1
fi
COMMITS_COUNT=`git rev-list --count $RELEASE_BASE..v$VERSION_PREV`
if [[ $COMMITS_COUNT == 0 ]]; then
echo "Version is already merged"
exit 1
fi
if ! git checkout -b "merge/v$VERSION_PREV" master; then
echo "Could not create merge branch"
exit 1
fi
if ! git cherry-pick $RELEASE_BASE.."v$VERSION_PREV"; then
echo "Automatic cherry-picking has failed"
exit 1
fi