From a121128d286a409e13b4f986c3af799597e7d375 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Sun, 17 Dec 2017 15:52:16 +0000 Subject: [PATCH] Improve deployment --- package.json | 4 +++- scripts/deploy.sh | 2 -- scripts/update-version-file.sh | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100755 scripts/update-version-file.sh diff --git a/package.json b/package.json index fd7079f..1f03f4c 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,11 @@ "repository": "gitlab:skddc/inspektor", "scripts": { "build": "ember build", + "build-prod": "ember build --environment production && npm run update-version-file", "start": "ember server", "test": "ember test", - "deploy": "bash scripts/deploy.sh" + "deploy": "npm run build-prod && bash scripts/deploy.sh", + "update-version-file": "bash scripts/update-version-file.sh" }, "devDependencies": { "broccoli-asset-rev": "^2.4.5", diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 8c52269..fc2444f 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,8 +1,6 @@ #!/bin/sh set -xe -# Pull build branch to make sure it's up to date -git pull origin build-production # Check out build branch git checkout build-production # Copy from build dir to root diff --git a/scripts/update-version-file.sh b/scripts/update-version-file.sh new file mode 100755 index 0000000..ac29f68 --- /dev/null +++ b/scripts/update-version-file.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +PACKAGE_VERSION=$(cat package.json \ + | grep version \ + | head -1 \ + | awk -F: '{ print $2 }' \ + | sed 's/[",]//g' \ + | tr -d '[[:space:]]') + +echo $PACKAGE_VERSION > dist/VERSION