release script, moved all scripts to bin directory

This commit is contained in:
azivner
2017-12-25 15:01:33 -05:00
parent bca5087426
commit f90c2317fc
6 changed files with 66 additions and 16 deletions

18
bin/build.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
echo 'module.exports = { build_date:"'`date --iso-8601=seconds`'", build_revision: "'`git log -1 --format="%H"`'" };' > services/build.js
echo "Deleting dist"
rm -r dist/*
cp -r ../trilium-node-binaries/sqlite/* node_modules/sqlite3/lib/binding/
cp -r ../trilium-node-binaries/scrypt/* node_modules/scrypt/bin/
./node_modules/.bin/electron-rebuild
./node_modules/.bin/electron-packager . --out=dist --platform=linux,win32 --overwrite
# 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/

7
bin/export-schema.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
SCHEMA_FILE_PATH=db/schema.sql
sqlite3 ~/trilium-data/document.db .schema > "$SCHEMA_FILE_PATH"
echo "DB schema exported to $SCHEMA_FILE_PATH"

16
bin/generate-cert.sh Normal file
View File

@@ -0,0 +1,16 @@
#!/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.
if [ $# -eq 0 ]
then
DIR=~/trilium-data/cert
else
DIR=$1
fi
mkdir -p "$DIR"
cd "$DIR"
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 2000 -nodes

11
bin/package.sh Executable file
View File

@@ -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

52
bin/release.sh Executable file
View File

@@ -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"