-
Notifications
You must be signed in to change notification settings - Fork 3
/
deploy.sh
executable file
·33 lines (33 loc) · 2.03 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
git checkout master && \
export VERSION=`git show --pretty="format:%aI.%h" -s` && \
echo VERSION: $VERSION && \
hatool content/script.yaml script.$VERSION.json && \
md5 script.$VERSION.json || md5sum script.$VERSION.json && \
export SCRIPT_VERSION=`(md5 script.$VERSION.json || md5sum script.$VERSION.json) |cut -f 1 -d ' '` && \
mv script.$VERSION.json ui/projects/businessgate/src/assets/script.$SCRIPT_VERSION.json && \
echo "export const VERSION='$VERSION';" > ui/projects/businessgate/src/app/version.ts && \
echo "export const SCRIPT_VERSION='$SCRIPT_VERSION';" >> ui/projects/businessgate/src/app/version.ts && \
git add ui/projects/businessgate/src/assets/script.$SCRIPT_VERSION.json || true && \
curl -L 'https://opendata.hasadna.org.il/dataset/d854bea1-69af-4763-a2b7-8b193bba2ca3/resource/3830d521-c9b3-46fe-9ba4-2d90483f79a2/download/business_kind_licensing_rules.json' > ui/projects/businessgate/src/assets/business_kind_licensing_rules.json && \
curl -L 'https://opendata.hasadna.org.il/dataset/d854bea1-69af-4763-a2b7-8b193bba2ca3/resource/371dad70-c782-4568-a3c1-8013d460521d/download/business_kind_property_tax_rules.json' > ui/projects/businessgate/src/assets/business_kind_property_tax_rules.json && \
git add ui/projects/businessgate/src/assets/business_kind_licensing_rules.json || true && \
git add ui/projects/businessgate/src/assets/business_kind_property_tax_rules.json || true && \
git commit -m "Automatic update of script for version $SCRIPT_VERSION" || true && \
git push || true && \
(git branch -D dist || true) && \
git checkout -b dist && \
(cd data && python prepare_stacks.py) && \
rm ui/.gitignore && \
(cd ui && npm run prod) && \
cp ui/dist/businessgate/index.html ui/dist/businessgate/404.html && \
cp CNAME ui/dist/businessgate/ && \
git add ui/dist/businessgate && \
git commit -m dist && \
(git branch -D gh-pages || true) && \
git subtree split --prefix ui/dist/businessgate -b gh-pages && \
git push -f origin gh-pages:gh-pages && \
git checkout master && \
git branch -D gh-pages && \
git branch -D dist && \
git checkout .