From a1fed50211a1b2421384ec3fde9c1afd82744be3 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Wed, 22 Apr 2020 19:51:49 -0400 Subject: [PATCH] ci: Add build script and release recipe After a few times, this got super painful to do by hand. The current game plan is to do all the webpack building on the local dev machine, as the VM has only 1G RAM and runs out of memory compiling the scss (yikes). Luckily, the whole idea of webpack is that it doesn't need to rebuild if the JS doesn't change, so for our production env, we only need a subset of the repository. --- .gitignore | 3 ++- Makefile | 5 +++++ build.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 build.sh diff --git a/.gitignore b/.gitignore index 040f3df..8366403 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules public/asset tags - +/build/ +/build.*/ diff --git a/Makefile b/Makefile index e7ccf96..c67b97a 100644 --- a/Makefile +++ b/Makefile @@ -9,3 +9,8 @@ tags: test: perl -c gloat.pl perl t/Game.t + +.PHONY: release +release: + ./build.sh + scp -r build/* www@euchre.live:/var/www/euchre-live diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..64310f8 --- /dev/null +++ b/build.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# build.sh -- build webpack assets +set -e +die() { + echo "$1" 1>&2 + exit 1 +} + +[ -e "gloat.pl" ] || die "Must be in root of euchre-live" + +# Set env vars to force a production build +# export MOJO_MODE=${MOJO_MODE:="production"} # TODO: use in server +export MOJO_WEBPACK_VERBOSE=1 +export MOJO_WEBPACK_BUILD=1 + +# Run an effectively no-op (non daemonizing) command to kick it off +./gloat.pl routes + +# Make the build directory +[ -d "build" ] && mv build build.`date +%s` +mkdir build +cp -a public lib gloat.pl build + +echo "---------------------------------------------------------------" +echo " Build Success!" +echo "---------------------------------------------------------------" -- libgit2 1.1.1