-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: release directly from master branch
- Loading branch information
Showing
3 changed files
with
25 additions
and
131 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,47 +4,50 @@ set -eu | |
set -o pipefail | ||
|
||
function set_cmake_version { | ||
sed -i "s/\(set(PROJECT_VERSION \"\).*\")/\1${1}\")/g" CMakeLists.txt | ||
sed -i "s/\(project(Disman VERSION \).*)/\1${1})/g" CMakeLists.txt | ||
} | ||
|
||
# We start from master (that has the beta tag). | ||
# We always start branching from master. | ||
git checkout master | ||
|
||
# Something like: [email protected].0 | ||
# Something like: v0.6XX.0 | ||
LAST_TAG=$(git describe --abbrev=0) | ||
CURRENT_BETA_VERSION=$(echo $LAST_TAG | sed -e 's,disman@\(\),\1,g') | ||
LAST_MINOR_VERSION=$(echo $LAST_TAG | sed -e 's,v\(\),\1,g') | ||
|
||
echo "Current beta version is: $CURRENT_BETA_VERSION" | ||
|
||
# We always release from stable branch. | ||
BRANCH_NAME="Plasma/$(echo $CURRENT_BETA_VERSION | sed -e 's,^\w.\(\w\)\(\w*\).*,\1.\2,g')" | ||
echo "Stable branch name: $BRANCH_NAME" | ||
git checkout $BRANCH_NAME | ||
echo "Last released minor version was: $LAST_MINOR_VERSION" | ||
|
||
# This updates version number from beta to its release | ||
RELEASE_VERSION=$(semver -i minor $CURRENT_BETA_VERSION) | ||
|
||
# The CMake project version is the same as the release version. | ||
CMAKE_VERSION=$RELEASE_VERSION | ||
NEXT_MINOR_VERSION=$(semver -i minor $LAST_MINOR_VERSION) | ||
|
||
echo "Next stable version: '${RELEASE_VERSION}' Corresponding CMake project version: '${CMAKE_VERSION}'" | ||
echo "Next minor version: '${NEXT_MINOR_VERSION}'" | ||
|
||
# This creates the changelog. | ||
standard-version -t disman\@ --skip.commit true --skip.tag true --preMajor --release-as $RELEASE_VERSION | ||
standard-version -t v --skip.commit true --skip.tag true --preMajor --release-as $NEXT_MINOR_VERSION | ||
|
||
# Set CMake version. | ||
set_cmake_version $CMAKE_VERSION | ||
set_cmake_version $NEXT_MINOR_VERSION | ||
|
||
# Now we have all changes ready. | ||
git add CMakeLists.txt CHANGELOG.md | ||
|
||
# Commit and tag it. | ||
git commit -m "build: create minor release ${RELEASE_VERSION}" -m "Update changelog and raise CMake project version to ${CMAKE_VERSION}." | ||
git tag -a "disman@${RELEASE_VERSION}" -m "Create minor release ${RELEASE_VERSION}." | ||
git commit -m "build: create release ${NEXT_MINOR_VERSION}" -m "Update changelog and raise CMake project version to ${NEXT_MINOR_VERSION}." | ||
git tag -a "v${NEXT_MINOR_VERSION}" -m "Create release ${NEXT_MINOR_VERSION}." | ||
|
||
# Now checkout the next stable branch. | ||
BRANCH_NAME="$(echo $NEXT_MINOR_VERSION | sed -e 's,^\(\w*\.\w*\)\..*,\1,g')" | ||
echo "New stable branch name: $BRANCH_NAME" | ||
git checkout -b $BRANCH_NAME | ||
|
||
# Go back to master branch and update changelog. | ||
# Go back to master branch and update version to next release. | ||
git checkout master | ||
git checkout $BRANCH_NAME CHANGELOG.md | ||
git commit -m "docs: update changelog" -m "Update changelog from branch $BRANCH_NAME at minor release ${RELEASE_VERSION}." | ||
MASTER_CMAKE_VERSION=$(echo $NEXT_MINOR_VERSION | sed -e 's,\w$,80,g') | ||
|
||
# Set CMake version | ||
set_cmake_version $MASTER_CMAKE_VERSION | ||
|
||
# And commit the updated version. | ||
git add CMakeLists.txt | ||
git commit -m "build: raise CMake project version to ${MASTER_CMAKE_VERSION}" -m "For development on master branch." | ||
|
||
echo "Changes applied. Check integrity of master and $BRANCH_NAME branches. Then issue 'git push --follow-tags' on both." |