forked from MapComplete/MapComplete
Create a build script which splits deployment
This commit is contained in:
parent
70aa6eb003
commit
928d119816
5 changed files with 37 additions and 37 deletions
22
scripts/build.sh
Normal file
22
scripts/build.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#! /bin/bash
|
||||
|
||||
# The build script; we build the application step by step as building everything at once takes too much RAM
|
||||
# Should be run from the repository root
|
||||
rm -rf dist/*
|
||||
rm -rf .cache
|
||||
mkdir dist 2> /dev/null
|
||||
|
||||
# Copy the layer files, as these might contain assets (e.g. svgs)
|
||||
cp -r assets/layers/ dist/assets/layers/
|
||||
cp -r assets/themes/ dist/assets/themes/
|
||||
cp -r assets/svg/ dist/assets/svg/
|
||||
parcel build --no-source-maps --public-url ./ "index.html" "404.html" "professional.html" "automaton.html" "land.html" "customGenerator.html" "theme.html" vendor
|
||||
|
||||
for file in $(ls index_*.ts)
|
||||
do
|
||||
theme=${file:6:-3}
|
||||
echo $theme
|
||||
# Builds the necessary files for just one theme, e.g. 'bookcases.html' + 'index_bookcases.ts' + supporting file
|
||||
# npm run generate && node --max_old_space_size=12000 $(which parcel) build
|
||||
parcel build --no-source-maps --public-url ./ "$theme.html"
|
||||
done
|
|
@ -1,27 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
|
||||
# To run with crontab:
|
||||
# */1 * * * * /home/pietervdvn/git/MapComplete/scripts/deployIfChanged.sh >> /home/pietervdvn/auto_deploy_caching.log 2>&1
|
||||
|
||||
PATH=/home/pietervdvn/.local/bin:/home/pietervdvn/.nvm/versions/node/v16.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/pietervdvn/.dotnet/tools
|
||||
|
||||
|
||||
cd ~/git/MapComplete
|
||||
|
||||
git fetch
|
||||
HEADHASH=$(git rev-parse HEAD)
|
||||
UPSTREAMHASH=$(git rev-parse master@{upstream})
|
||||
|
||||
if [ "$HEADHASH" != "$UPSTREAMHASH" ]
|
||||
then
|
||||
echo Not up to date with origin. Deploying!
|
||||
git pull
|
||||
npm run generate:translations
|
||||
git commit -am "Sync translations"
|
||||
git push
|
||||
npm run generate:docs
|
||||
git commit -am "Autgenerate docs and taginfo files"
|
||||
|
||||
npm run deploy:production
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue