-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
72 lines (67 loc) · 2.15 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
62
63
64
65
66
67
68
69
70
71
72
default:
image: hub.ilearned.eu/i-learned/ci-cd/blog-builder
tags:
- AMD64
stages:
- lint
- test
- .after
prettier:
stage: lint
allow_failure: true
script:
- rm -rf ./..?* ./.[!.]* ./*
- git clone https://gitlab.ilearned.eu/i-learned/blog/theme.git -b $CI_COMMIT_REF_NAME . --recursive
- git submodule update --recursive --remote
- prettier . -w
- git add .
- git commit -m "[🧹 Lint] Linted code and updated submodule"
- git push https://CI_CD:[email protected]/i-learned/blog/theme.git
only:
- master
test-job:
stage: test
script:
- rm -rf ./..?* ./.[!.]* ./*
- git clone https://gitlab.ilearned.eu/i-learned/blog/theme.git . -b $CI_COMMIT_REF_NAME --recursive
- git submodule update --recursive --remote
- pip install -r requirements.txt
- make build
artifacts:
paths:
- output/
lighthouse-job:
image: hub.ilearned.eu/i-learned/ci-cd/pelican-chrome95-ff94
stage: .after
script:
- lhci autorun --outputDir=public/ --collect.settings.chromeFlags="--no-sandbox" || echo "LHCI failed!"
- mkdir public
- mv *report.html public/
- mv manifest.json public/
- mv *report.json public/
artifacts:
paths:
- public/
dependencies:
- test-job
prod-deploy-job:
stage: .after
script:
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$SSH_EBANVM01_PRIVATE_KEY" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- rsync -az --delete -e "ssh -i ~/.ssh/id_ed25519" output/ [email protected]:/var/www/ilearned-blog
dependencies:
- test-job
rules:
- if: $CI_COMMIT_BRANCH == "master" && $CI_COMMIT_AUTHOR != "Gitlab CI <[email protected]>"
test-deploy-job:
stage: .after
script:
- netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_AUTH_TOKEN --dir output
dependencies:
- test-job
only:
- merge_requests