1#!/bin/bash 2 3set -eu 4set -o pipefail 5 6function set_cmake_version { 7 sed -i "s/\(set(PROJECT_VERSION \"\).*\")/\1${1}\")/g" CMakeLists.txt 8} 9 10# We start from master (that has the beta tag). 11git checkout master 12 13# Something like: kdisplay@5.XX.0-beta.0 14LAST_TAG=$(git describe --abbrev=0) 15CURRENT_BETA_VERSION=$(echo $LAST_TAG | sed -e 's,kdisplay@\(\),\1,g') 16 17echo "Current beta version is: $CURRENT_BETA_VERSION" 18 19# We always release from stable branch. 20BRANCH_NAME="Plasma/$(echo $CURRENT_BETA_VERSION | sed -e 's,^\(\w*\.\w*\)\..*,\1,g')" 21echo "Stable branch name: $BRANCH_NAME" 22git checkout $BRANCH_NAME 23 24# This updates version number from beta to its release 25RELEASE_VERSION=$(semver -i minor $CURRENT_BETA_VERSION) 26 27# The CMake project version is the same as the release version. 28CMAKE_VERSION=$RELEASE_VERSION 29 30echo "Next stable version: '${RELEASE_VERSION}' Corresponding CMake project version: '${CMAKE_VERSION}'" 31 32# This creates the changelog. 33standard-version -t kdisplay\@ --skip.commit true --skip.tag true --preMajor --release-as $RELEASE_VERSION 34 35# Set CMake version. 36set_cmake_version $CMAKE_VERSION 37 38# Now we have all changes ready. 39git add CMakeLists.txt CHANGELOG.md 40 41# Commit and tag it. 42git commit -m "build: create minor release ${RELEASE_VERSION}" -m "Update changelog and raise CMake project version to ${CMAKE_VERSION}." 43git tag -a "kdisplay@${RELEASE_VERSION}" -m "Create minor release ${RELEASE_VERSION}." 44 45# Go back to master branch and update changelog. 46git checkout master 47git checkout $BRANCH_NAME CHANGELOG.md 48git commit -m "docs: update changelog" -m "Update changelog from branch $BRANCH_NAME at minor release ${RELEASE_VERSION}." 49 50echo "Changes applied. Check integrity of master and $BRANCH_NAME branches. Then issue 'git push --follow-tags' on both." 51