Skip to content

Build your personal knowledge base with Trilium Notes

release script, moved all scripts to bin directory

azivnerf90c2317fc89
diff --git a/build.sh b/bin/build.sh
similarity index 64%
rename from build.sh
rename to bin/build.sh
index 501af3e5d9..20a9c84d4a 100755
--- a/build.sh
+++ b/bin/build.sh
@@ -1,6 +1,6 @@
-#!/bin/bash
+#!/usr/bin/env bash
-./set-build.sh
+echo 'module.exports = { build_date:"'`date --iso-8601=seconds`'", build_revision: "'`git log -1 --format="%H"`'" };' > services/build.js
echo "Deleting dist"
@@ -16,13 +16,3 @@ cp -r ../trilium-node-binaries/scrypt/* node_modules/scrypt/bin/
# can't copy this before the packaging because the same file name is used for both linux and windows build
cp ../trilium-node-binaries/scrypt.node ./dist/trilium-win32-x64/resources/app/node_modules/scrypt/build/Release/
-
-VERSION=`jq -r ".version" package.json`
-
-echo "Packaging windows distribution..."
-
-7z a dist/trilium-windows-${VERSION}.7z dist/trilium-win32-x64
-
-echo "Packaging linux distribution..."
-tar cfJ dist/trilium-linux-${VERSION}.tar.xz dist/trilium-linux-x64
-
diff --git a/export-schema.sh b/bin/export-schema.sh
similarity index 100%
rename from export-schema.sh
rename to bin/export-schema.sh
diff --git a/generate-cert.sh b/bin/generate-cert.sh
similarity index 94%
rename from generate-cert.sh
rename to bin/generate-cert.sh
index 770bddbf00..6ad8eafd4b 100644
--- a/generate-cert.sh
+++ b/bin/generate-cert.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Script generates certificate by default into the ~/trilium-data/cert where it is expected by Trilium
# If directory is given in argument, certificate will be created there.
diff --git a/bin/package.sh b/bin/package.sh
new file mode 100755
index 0000000000..f8f5e68069
--- /dev/null
+++ b/bin/package.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+VERSION=`jq -r ".version" package.json`
+
+cd dist
+
+echo "Packaging windows electron distribution..."
+7z a trilium-windows-${VERSION}.7z trilium-win32-x64
+
+echo "Packaging linux electron distribution..."
+7z a trilium-linux-${VERSION}.7z trilium-linux-x64
diff --git a/bin/release.sh b/bin/release.sh
new file mode 100755
index 0000000000..6f544de28b
--- /dev/null
+++ b/bin/release.sh
@@ -0,0 +1,52 @@
+#!/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
+
+jq '.version = "$VERSION"' package.json|sponge package.json
+
+TAG=v$VERSION
+
+git commit -m "$VERSION"
+git push
+
+git tag $TAG
+git push origin $TAG
+
+echo "Releasing Trilium $VERSION"
+
+build
+
+package
+
+LINUX_BUILD=trilium-linux-$VERSION.7z
+WINDOWS_BUILD=trilium-windows-$VERSION.7z
+
+github-release release \
+ --tag $TAG \
+ --name "$TAG release"
+
+github-release upload \
+ --tag $TAG \
+ --name "$LINUX_BUILD" \
+ --file "dist/$LINUX_BUILD"
+
+github-release upload \
+ --tag $TAG \
+ --name "$WINDOWS_BUILD" \
+ --file "dist/$WINDOWS_BUILD"
\ No newline at end of file
diff --git a/set-build.sh b/set-build.sh
deleted file mode 100755
index bee63ef4d5..0000000000
--- a/set-build.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env bash
-
-echo 'module.exports = { build_date:"'`date --iso-8601=seconds`'", build_revision: "'`git log -1 --format="%H"`'" };' > services/build.js
\ No newline at end of file