aboutsummaryrefslogtreecommitdiff
path: root/deploy.sh
diff options
context:
space:
mode:
authorJakob Stendahl <jakobste@uio.no>2021-02-06 19:51:13 +0100
committerJakob Stendahl <jakobste@uio.no>2021-02-06 19:51:13 +0100
commitd9ca888c288b14592462e586ace4099ffbfa6db2 (patch)
treea250cb278820ba89a4288be1294c6126a86bdcdd /deploy.sh
parentb07c2d6792174c9132679671ea7dae77c87349d9 (diff)
downloadhoverbit-ble-d9ca888c288b14592462e586ace4099ffbfa6db2.tar.gz
hoverbit-ble-d9ca888c288b14592462e586ace4099ffbfa6db2.zip
Add title, version to app, add deploy-script
1.1.0 1.1.1 1.1.2 Work on deployscript Try to fix sed Add x to deploy Fix sed Add gitignore Version test 1.0.1 test 1.1.0 1.1.1 test
Diffstat (limited to 'deploy.sh')
-rwxr-xr-xdeploy.sh63
1 files changed, 63 insertions, 0 deletions
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..5a8bd10
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+if output=$(git status --porcelain) && [ -z "$output" ]; then
+ echo "Git working directory is clean."
+else
+ echo "Git working directory is not clean..."
+ exit 1
+fi
+
+tput setaf 4
+echo "> Bump version number"
+tput sgr0
+
+if [ $# -gt 0 ]; then
+ npm version "$1" || exit 1;
+else
+ npm version patch || exit 1;
+fi
+
+VERSION=$(cat package.json \
+ | grep version \
+ | head -1 \
+ | awk -F: '{ print $2 }' \
+ | sed 's/[",]//g' \
+ | tr -d '[[:space:]]')
+echo "Deploying for tag: $VERSION."
+
+tput setaf 4
+echo "> Build app"
+tput sgr0
+
+rm -r dist/
+npm install
+npm run build
+
+
+
+tput setaf 4
+echo "> Copy to gh-pages branch and commit"
+tput sgr0
+
+cp .gitignore dist/.gitignore
+git checkout gh-pages || git checkout --orphan gh-pages
+git rm -rf .
+
+cp dist/.gitignore .gitignore
+cp -r dist/* .
+
+sed -i".bak" "s/{{ VERSION }}/$VERSION/g" index.html
+rm index.html.bak
+
+git add .
+git commit -m ":rocket: Deploy app v$VERSION"
+
+
+tput setaf 4
+echo "> Return to controller branch and tag last commit"
+tput sgr0
+
+git checkout controller
+
+#git push --follow-tags origin controller
+#git push origin gh-pages