2017-12-25 15:01:33 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2025-03-07 23:57:31 +02:00
|
|
|
set -e
|
|
|
|
|
2017-12-25 15:01:33 -05:00
|
|
|
if [[ $# -eq 0 ]] ; then
|
|
|
|
echo "Missing argument of new version"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-07-14 21:12:51 +03:00
|
|
|
if ! command -v jq &> /dev/null; then
|
|
|
|
echo "Missing command: jq"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-12-25 15:01:33 -05:00
|
|
|
VERSION=$1
|
|
|
|
|
|
|
|
if ! [[ ${VERSION} =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(-.+)?$ ]] ;
|
|
|
|
then
|
|
|
|
echo "Version ${VERSION} isn't in format X.Y.Z"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! git diff-index --quiet HEAD --; then
|
|
|
|
echo "There are uncommitted changes"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-12-25 21:05:08 -05:00
|
|
|
echo "Releasing Trilium $VERSION"
|
|
|
|
|
2024-07-14 21:13:06 +03:00
|
|
|
jq '.version = "'$VERSION'"' package.json > package.json.tmp
|
|
|
|
mv package.json.tmp package.json
|
2017-12-25 15:01:33 -05:00
|
|
|
|
2017-12-25 21:06:35 -05:00
|
|
|
git add package.json
|
|
|
|
|
2025-02-14 08:38:18 +01:00
|
|
|
npm run chore:update-build-info
|
2017-12-25 21:05:08 -05:00
|
|
|
|
2024-02-17 19:09:36 +02:00
|
|
|
git add src/services/build.ts
|
2017-12-25 21:06:35 -05:00
|
|
|
|
2017-12-25 15:01:33 -05:00
|
|
|
TAG=v$VERSION
|
|
|
|
|
2017-12-25 21:05:08 -05:00
|
|
|
echo "Committing package.json version change"
|
|
|
|
|
2025-02-22 14:02:13 +02:00
|
|
|
git commit -m "chore(release): $VERSION"
|
2017-12-25 15:01:33 -05:00
|
|
|
git push
|
|
|
|
|
2017-12-25 21:05:08 -05:00
|
|
|
echo "Tagging commit with $TAG"
|
|
|
|
|
2017-12-25 15:01:33 -05:00
|
|
|
git tag $TAG
|
|
|
|
git push origin $TAG
|
2025-02-22 14:25:31 +02:00
|
|
|
|
|
|
|
echo "Updating master"
|
|
|
|
|
|
|
|
git fetch
|
|
|
|
git checkout master
|
|
|
|
git reset --hard origin/master
|
|
|
|
git merge origin/develop
|
|
|
|
git push
|