-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
61 lines (52 loc) · 1.48 KB
/
.gitlab-ci.yml
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
default:
image: alpine:latest
tags:
- AMD64
stages:
- lint
- build
- prod-deploy
linter:
stage: lint
image: hub.ilearned.eu/i-learned/ci-cd/website-builder
allow_failure: true
script:
- npm install -g prettier sass-lint
- prettier templates/ -w
- sass-lint static/sass/*.sass
- git add .
- git config --global user.email "contact@ilearned.eu"
- git config --global user.name "Gitlab CI"
- git commit -m "[🧹 Lint] Linted code"
- git push https://CI_CD:$CI_GIT_USER_PASSWD@gitlab.ilearned.eu/i-learned/website/ HEAD:main
only:
- main
prod-deploy-job:
stage: prod-deploy
image: hub.ilearned.eu/i-learned/ci-cd/website-builder
script:
- python3 build.py
- wget https://github.com/tdewolff/minify/releases/download/v2.10.0/minify_linux_amd64.tar.gz
- tar -xf minify_linux_amd64.tar.gz -C /tmp
- /tmp/minify --html-keep-comments -r -o output/ output/
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$SSH_KEY" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- rsync -az --exclude=".git*" --delete -e "ssh -p 22 -i ~/.ssh/id_ed25519" output/ deploy@eban.eu.org:/var/www/ilearned
only:
- main
artifacts:
paths:
- output
build-job:
stage: build
image: hub.ilearned.eu/i-learned/ci-cd/website-builder
script:
- python3 build.py
only:
- main
artifacts:
paths:
- output