forked from hkoscon/2023
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
87 lines (80 loc) · 1.71 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
default:
image: docker.io/library/node:20
cache:
key:
files:
- package-lock.json
paths:
- .npm/
- node_modules
- .next/cache
before_script:
- npm ci --cache .npm --prefer-offline
stages:
- test
- build
- deploy
audit:
stage: test
script:
- npm audit
allow_failure: true
lint:
stage: test
script:
- npm run lint
test:
stage: test
script:
- npm run test
artifacts:
reports:
junit: [junit.xml]
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
build:
stage: build
script:
- curl -o src/app/meta.json $EVENT_INFO_URL
- curl -o src/app/events.json $TOPICS_URL
- curl -o src/app/timetable.json $TIMETABLE_URL
- node ./hacks/generate-opass-timetable.js
- npm run build
- cp out/404/index.html out/404.html
- rm -rf out/404
- find out -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
artifacts:
paths:
- out
pages:
stage: deploy
needs:
- job: build
artifacts: true
image: docker.io/library/ubuntu:22.04
before_script:
- apt-get update && apt-get install brotli -y
script:
- cp -r out public
- find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec brotli -f -k {} \;
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == 'main'
- if: $CI_COMMIT_BRANCH == 'develop'
environment:
name: staging
deploy:github-page:
stage: deploy
needs:
- job: build
artifacts: true
script:
- cp -r out public
- bash ./.gitlab/scripts/deploy-github-pages.sh
rules:
- if: $CI_COMMIT_BRANCH == 'main'
environment:
name: production