trilium/bin/release.sh

106 lines
2.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
if [[ $# -eq 0 ]] ; then
echo "Missing argument of new version"
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-26 10:05:08 +08:00
echo "Releasing Trilium $VERSION"
2017-12-26 09:45:59 +08:00
jq '.version = "'$VERSION'"' package.json|sponge package.json
git add package.json
2018-04-10 10:30:11 +08:00
echo 'module.exports = { buildDate:"'`date --iso-8601=seconds`'", buildRevision: "'`git log -1 --format="%H"`'" };' > src/services/build.js
2017-12-26 10:05:08 +08:00
2018-04-10 10:30:11 +08:00
git add src/services/build.js
TAG=v$VERSION
2017-12-26 10:05:08 +08:00
echo "Committing package.json version change"
git commit -m "release $VERSION"
git push
2017-12-26 10:05:08 +08:00
echo "Tagging commit with $TAG"
git tag $TAG
git push origin $TAG
2017-12-26 10:05:08 +08:00
bin/build.sh
2017-12-28 06:39:41 +08:00
LINUX_X64_BUILD=trilium-linux-x64-$VERSION.7z
LINUX_IA32_BUILD=trilium-linux-ia32-$VERSION.7z
WINDOWS_X64_BUILD=trilium-windows-x64-$VERSION.7z
MAC_X64_BUILD=trilium-mac-x64-$VERSION.7z
2018-08-15 01:52:17 +08:00
SERVER_BUILD=trilium-linux-x64-server-$VERSION.7z
2017-12-26 10:05:08 +08:00
echo "Creating release in GitHub"
EXTRA=
if [[ $TAG == *"beta"* ]]; then
EXTRA=--pre-release
fi
github-release release \
--tag $TAG \
--name "$TAG release" $EXTRA
2017-12-28 06:39:41 +08:00
echo "Uploading linux x64 build"
2017-12-26 10:05:08 +08:00
github-release upload \
--tag $TAG \
2017-12-28 06:39:41 +08:00
--name "$LINUX_X64_BUILD" \
--file "dist/$LINUX_X64_BUILD"
2017-12-28 06:39:41 +08:00
echo "Uploading linux ia32 build"
2017-12-26 10:05:08 +08:00
github-release upload \
--tag $TAG \
2017-12-28 06:39:41 +08:00
--name "$LINUX_IA32_BUILD" \
--file "dist/$LINUX_IA32_BUILD"
echo "Uploading windows x64 build"
github-release upload \
--tag $TAG \
--name "$WINDOWS_X64_BUILD" \
--file "dist/$WINDOWS_X64_BUILD"
2017-12-26 10:05:08 +08:00
echo "Uploading mac x64 build"
github-release upload \
--tag $TAG \
--name "$MAC_X64_BUILD" \
--file "dist/$MAC_X64_BUILD"
2018-12-02 15:42:11 +08:00
echo "Uploading linux x64 server build"
github-release upload \
--tag $TAG \
--name "$SERVER_BUILD" \
--file "dist/$SERVER_BUILD"
echo "Building docker image"
2018-06-11 03:06:52 +08:00
bin/build-docker.sh $VERSION
echo "Pushing docker image to dockerhub"
2018-06-11 03:06:52 +08:00
bin/push-docker-image.sh $VERSION
2017-12-26 10:05:08 +08:00
echo "Release finished!"