-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Script release commands * Make release script check we're on main and in line with origin
- Loading branch information
1 parent
8833a77
commit 1e86bd4
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |