-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
99 lines (91 loc) · 3.21 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
88
89
90
91
92
93
94
95
96
97
98
99
image: node:16.5.0
stages:
- build
- deploy
variables:
SOURCEMAP_BASE_URL: https://lucidac-gui.anabrid.dev/main/
default:
cache:
key:
files:
- package-lock.json
prefix: npm
paths:
- node_modules/
build_headless:
stage: build
script:
- npm install
- ENDPOINT="" npm run build
- cp *.md dist/
- echo HEADLESS_JOB_ID=$CI_JOB_ID > .anabrid_build_result.env
artifacts:
paths:
- dist
reports:
dotenv: .anabrid_build_result.env
build_for_teensy:
stage: build
script:
- npm install
- npm run build
- cp *.md dist/
- echo EMBEDDED_JOB_ID=$CI_JOB_ID > .anabrid_build_result.env
artifacts:
paths:
- dist
reports:
dotenv: .anabrid_build_result.env
upload_headless_to_webserver:
stage: deploy
image: svenk/latex
needs:
- build_headless
script:
- chmod 600 "$SSH_PRIVATE_KEY_FILE_STAGING"
- echo "ai.svenk.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBE2YTwpWWq4ceRXHbCFHlw5kmRVLQjKbdYeFAAyYUDXFRhCjRknE6DKlGIIciKOqzAMiFGz5/vxb6tKMCKBeFU0=" > ~/userknown.txt
- echo cd anabrid.dev/lucidac-gui/main/ >> sftp-commands.txt
- echo "put -R dist/*" >> sftp-commands.txt
- cat sftp-commands.txt | sftp -o "UserKnownHostsFile=~/userknown.txt" -i"$SSH_PRIVATE_KEY_FILE_STAGING" $DEPLOY_STAGING_SSH_HOST
upload_release_to_webserver:
stage: deploy
image: svenk/latex
rules:
- if: $CI_COMMIT_TAG
needs:
- build_headless
script:
- chmod 600 "$SSH_PRIVATE_KEY_FILE_STAGING"
- echo "ai.svenk.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBE2YTwpWWq4ceRXHbCFHlw5kmRVLQjKbdYeFAAyYUDXFRhCjRknE6DKlGIIciKOqzAMiFGz5/vxb6tKMCKBeFU0=" > ~/userknown.txt
- echo mkdir anabrid.dev/lucidac-gui/${CI_COMMIT_TAG} >> sftp-commands.txt
- echo cd anabrid.dev/lucidac-gui/${CI_COMMIT_TAG}/ >> sftp-commands.txt
- echo "put -R dist/*" >> sftp-commands.txt
- cat sftp-commands.txt | sftp -o "UserKnownHostsFile=~/userknown.txt" -i"$SSH_PRIVATE_KEY_FILE_STAGING" $DEPLOY_STAGING_SSH_HOST
gitlab_release:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
needs:
- job: build_headless
artifacts: true
- job: build_for_teensy
artifacts: true
script:
- echo "Releasing artifacts built in build jobs ${HEADLESS_JOB_ID}."
- echo "and ${EMBEDDED_JOB_ID}."
# by the way, git is available in image, can also accumulate interesting information for changelog
release:
name: 'LUCIDAC-GUI $CI_COMMIT_TAG'
# TODO: Would be nice to load changelog here.
description: 'LUCIDAC-GUI CI-triggered release version $CI_COMMIT_TAG. See CHANGELOG for details.'
# tag_name is a mendatory field and can not be an empty string
tag_name: '$CI_COMMIT_TAG'
assets:
links:
- name: 'Static HTML/JS/CSS Bundle for headless use'
url: '$CI_PROJECT_URL/-/jobs/${HEADLESS_JOB_ID}/artifacts/download'
filepath: /lucidac-gui-headless-$CI_COMMIT_TAG.zip
- name: 'Static HTML/JS/CSS Bundle for embedded use'
url: '$CI_PROJECT_URL/-/jobs/${EMBEDDED_JOB_ID}/artifacts/download'
filepath: /lucidac-gui-embedded-$CI_COMMIT_TAG.zip