🔨 Add changelog and version updates to release.sh

This commit is contained in:
James Panther
2021-08-22 16:55:10 +10:00
parent 72b636b635
commit 0293d0652b
6 changed files with 56 additions and 24 deletions
+47 -18
View File
@@ -6,34 +6,63 @@ branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
# push any local changes
git push
# checkout stable branch (this will catch uncommitted changes)
git checkout stable || exit 1
# run a build to catch any uncommitted updates
npm run build
# branch validation
if [ $branch = "dev" ]; then
echo "Enter the release version (eg. v1.0.0):"
read version
# check current branch is clean
if output=$(git status --porcelain) && [ -z "$output" ]; then
# get the version number
echo "Enter the release version (eg. v1.0.0):"
read version
echo "Started releasing $version for Congo..."
echo "Started releasing Congo $version..."
# pull latest from stable
git pull
# update package version
jq --arg version "$version" '.version=$version' package.json > package.tmp && mv package.tmp package.json
sed -i -e "1s/^\(\/\*! Congo \)v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/\1$version/" assets/css/main.css
# merge in changes from dev branch
git merge --no-ff dev -m "🔖 Release $version"
# update changelog
chan release $version || exit
npx prettier --write CHANGELOG.md
# create tag
git tag $version
# build project
npm run build
# push commit and tag to remote
git push
git push --tags
# commit version updates
git commit -a -m "🔨 Preparing release $version"
git push
echo "$version successfully released!"
echo "Returning to dev branch..."
# switch to stable branch
git checkout stable
git checkout dev
# pull latest from stable
git pull
# merge in changes from dev branch
git merge --no-ff dev -m "🔖 Release $version"
# create tag
git tag $version
# push commit and tag to remote
git push
git push --tags
# publish GitHub release
timeout 2 chan gh-release $version
echo "Congo $version successfully released! 🎉"
echo "Returning to dev branch..."
git checkout dev
else
echo "ERROR: There are unstaged changes in development!"
echo "Clean the working directory and try again."
fi
else
echo "Releases can only be published from the dev branch!"
echo "ERROR: Releases can only be published from the dev branch!"
fi