mirror of
https://github.com/mfocko/blog.git
synced 2024-11-22 04:53:47 +01:00
ci: automate deployment
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
9f9dc39a31
commit
117f865ee8
4 changed files with 42 additions and 10 deletions
34
.gitlab-ci.yml
Normal file
34
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
image: node:current-alpine3.15
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
test:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- yarn install
|
||||||
|
- URL=http://localhost BASE_URL=/ yarn build
|
||||||
|
except:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- shared-fi
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- mkdir -p ~/.ssh
|
||||||
|
- ln -s $SSH_CONFIG ~/.ssh/config
|
||||||
|
- ln -s $SSH_KEY ~/.ssh/id_ed25519
|
||||||
|
- ln -s $SSH_KNOWN_HOSTS ~/.ssh/known_hosts
|
||||||
|
- chmod 600 ~/.ssh/config ~/.ssh/id_ed25519 ~/.ssh/known_hosts
|
||||||
|
- apk update && apk add make graphviz zip openssh rsync
|
||||||
|
- yarn install
|
||||||
|
- make regenerate-dots
|
||||||
|
- make regenerate-zips
|
||||||
|
- make deploy-aisa
|
||||||
|
- make deploy-poincare
|
||||||
|
only:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- shared-fi
|
8
makefile
8
makefile
|
@ -2,19 +2,19 @@ dev: regenerate-dots regenerate-zips
|
||||||
URL=http://localhost BASE_URL=/ yarn run start
|
URL=http://localhost BASE_URL=/ yarn run start
|
||||||
|
|
||||||
deploy-aisa:
|
deploy-aisa:
|
||||||
URL=https://fi.muni.cz BASE_URL=~xfocko/kb/ yarn run build
|
URL="https://fi.muni.cz" BASE_URL="~xfocko/kb/" yarn run build
|
||||||
rsync -avzrlpptv --delete build/ aisa:~/public_html/kb/
|
rsync -avzrlpptv --delete build/ aisa:~/public_html/kb/
|
||||||
|
|
||||||
deploy-poincare:
|
deploy-poincare:
|
||||||
URL=https://fi.mfocko.xyz BASE_URL=/ yarn run build
|
URL="https://fi.mfocko.xyz" BASE_URL="/" yarn run build
|
||||||
rsync -avzrlpptv --delete build/ poincare:~/public_html/fi/
|
rsync -avzrlpptv --delete build/ poincare:~/public_html/fi/
|
||||||
|
|
||||||
deploy: regenerate-dots regenerate-zips deploy-aisa deploy-poincare
|
deploy: regenerate-dots regenerate-zips deploy-aisa deploy-poincare
|
||||||
|
|
||||||
regenerate-dots:
|
regenerate-dots:
|
||||||
bash regenerate-dots.sh
|
sh regenerate-dots.sh
|
||||||
|
|
||||||
regenerate-zips:
|
regenerate-zips:
|
||||||
bash regenerate-zips.sh
|
sh regenerate-zips.sh
|
||||||
|
|
||||||
.PHONY: deploy-aisa deploy-poincare regenerate-dots regenerate-zips
|
.PHONY: deploy-aisa deploy-poincare regenerate-dots regenerate-zips
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
FONT="Iosevka,'Iosevka Term','Cascadia Code','JetBrains Mono','Fira Code',monospace"
|
FONT="Iosevka,'Iosevka Term','Cascadia Code','JetBrains Mono','Fira Code',monospace"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# remove preexisting ZIPs
|
# remove preexisting ZIPs
|
||||||
find ./static/files -name '*.zip' -exec rm {} \;
|
find ./static/files -name '*.zip' -exec rm {} \;
|
||||||
|
@ -6,13 +6,11 @@ find ./static/files -name '*.zip' -exec rm {} \;
|
||||||
for relative_path in $(find ./static/files -name '.zipit' -print); do
|
for relative_path in $(find ./static/files -name '.zipit' -print); do
|
||||||
relative_path=$(dirname $relative_path)
|
relative_path=$(dirname $relative_path)
|
||||||
base=$(basename $relative_path)
|
base=$(basename $relative_path)
|
||||||
pushd $relative_path/..
|
cd $relative_path/..
|
||||||
|
|
||||||
echo "PWD: $PWD"
|
|
||||||
|
|
||||||
all_files=$(find $base/** ! -name '.zipit' -print)
|
all_files=$(find $base/** ! -name '.zipit' -print)
|
||||||
zip -9 $base.zip $all_files
|
zip -9 $base.zip $all_files
|
||||||
mv $base.zip $base/$base.zip
|
mv $base.zip $base/$base.zip
|
||||||
|
|
||||||
popd
|
cd -
|
||||||
done;
|
done;
|
Loading…
Reference in a new issue