Skip to content

Commit

Permalink
Script release commands (#2308)
Browse files Browse the repository at this point in the history
* Script release commands

* Make release script check we're on main and in line with origin
  • Loading branch information
danbenton-mojdt authored Aug 23, 2024
1 parent 8833a77 commit 1e86bd4
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

git fetch
currentBranch=$(git branch --show-current)

if [ "${currentBranch}" != 'main' ]
then
echo "Not on main, exiting"
exit 1
fi

diff=$(git diff origin/main --name-only)
if [ "${diff}" != '' ]
then
echo "Non-zero diff with origin, exiting"
exit 2
fi


# Get the latest tag, so we know what the next one will be
currentVersion=$(git describe --abbrev=0)

DATE=$(date "+%Y-%m-%d")
# Replace vx.x.x with the next version
read -p "Enter next version number (current: ${currentVersion}): " NEXT_VERSION

if [ "${NEXT_VERSION:0:1}" != 'v' ]
then
NEXT_VERSION="v${NEXT_VERSION}"
fi

echo
echo
echo "=========="
echo
echo "Tagging version ${NEXT_VERSION} with message \"Deploying on ${DATE}\""
echo

read -p "Press enter to continue... (Ctrl+C to cancel)" go

git tag -a ${NEXT_VERSION} -m "Deploying on ${DATE}"
git push origin $NEXT_VERSION

read -p Generate changelog? Enter to contine or Ctrl+C to quit

git checkout -b changelog-$NEXT_VERSION
bundle
rake changelog
git add CHANGELOG.md
git commit -m "Generated changelog for $NEXT_VERSION"
git push --set-upstream origin changelog-$NEXT_VERSION

0 comments on commit 1e86bd4

Please sign in to comment.