Skip to content

Commit

Permalink
build: release directly from master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
romangg committed Jun 19, 2024
1 parent 7727bb2 commit c33ec5f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 131 deletions.
63 changes: 0 additions & 63 deletions tooling/release/beta-prepare.sh

This file was deleted.

46 changes: 0 additions & 46 deletions tooling/release/beta-update-prepare.sh

This file was deleted.

47 changes: 25 additions & 22 deletions tooling/release/stable-minor-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."

0 comments on commit c33ec5f

Please sign in to comment.