Skip to content

Instantly share code, notes, and snippets.

@mcejp
Created May 21, 2023 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcejp/de079cec595862b74a283acdc70ebf86 to your computer and use it in GitHub Desktop.
Save mcejp/de079cec595862b74a283acdc70ebf86 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ $# -ne 1 ]] ; then
echo 'usage: make_release.sh RELEASE'
echo ' example: ./make-release.sh 2022.06'
exit 1
fi
set -e
RELEASE=$1
RELEASE_BRANCH=release/$RELEASE
DATE=$(date +%Y-%m-%d)
# Check for uncommitted changes
git update-index -q --ignore-submodules --refresh
# Disallow unstaged changes in the working tree
if ! git diff-files --quiet --ignore-submodules -- ; then
echo Unstaged changes, cannot proceed
exit 1
fi
# Disallow uncommitted changes in the index
if ! git diff-index --cached --quiet HEAD --ignore-submodules -- ; then
echo Uncommited changes, cannot proceed
exit 1
fi
# Update CHANGELOG.md, UPGRADING.md
sed -i "s/## Unreleased\$/## $RELEASE - $DATE/g" CHANGELOG.md
sed -i "s/## Unreleased\$/## $RELEASE - $DATE/g" UPGRADING.md
# Commit changes
git add CHANGELOG.md UPGRADING.md
if ! git diff-index --quiet HEAD -- ; then
git commit -m "Update CHANGELOG.md, UPGRADING.md for release $RELEASE"
fi
git checkout -b $RELEASE_BRANCH
# Update version in footer
sed -i "s/\$app_version = \"HEAD\";/\$app_version = \"$RELEASE\";/g" candb/bootstrap.php
grep "\$app_version = \"$RELEASE\"" candb/bootstrap.php >/dev/null
git add candb/bootstrap.php
git commit -m "Mark release $RELEASE"
git tag $RELEASE
git checkout develop
echo make-release: Tagged release $RELEASE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment