Notes/bin/release.sh

50 lines
846 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2019-07-18 20:20:38 +02:00
export GITHUB_REPO=trilium
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
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
git add package.json
npm run 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
TAG=v$VERSION
2017-12-25 21:05:08 -05:00
echo "Committing package.json version change"
git commit -m "release $VERSION"
git push
2017-12-25 21:05:08 -05:00
echo "Tagging commit with $TAG"
git tag $TAG
git push origin $TAG