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