-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.gitlab-ci.yml
48 lines (43 loc) · 1.53 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
image: node:18.19.0-alpine3.19
stages:
- build
- publish
- trigger
test:
stage: build
tags: [docker]
script:
- yarn
- yarn test
build:
stage: build
tags: [docker]
before_script:
- apk add jq git
# apply version from tag name
- jq '.version=(if env.CI_COMMIT_TAG == null then "0.0.0-snapshot" else env.CI_COMMIT_TAG end)' package.json > package.json.mod && mv package.json.mod package.json
script:
- yarn
- yarn build
artifacts:
paths:
- build/
publish-assets:
stage: publish
tags: [docker]
script:
- apk add jq curl
- tar -zcvf dist.tar.gz build/
- RELEASE_ID=$(curl -s -H "Authorization:token $GITHUB_API_TOKEN" https://api.github.com/repos/mysteriumnetwork/dvpn-web/releases/tags/$CI_COMMIT_TAG | jq -r .id)
- curl --data-binary @dist.tar.gz -H "Authorization:token $GITHUB_API_TOKEN" -H "Content-Type:application/octet-stream" https://uploads.github.com/repos/mysteriumnetwork/dvpn-web/releases/$RELEASE_ID/assets?name=dist.tar.gz
- curl --data-binary @compatibility.json -H "Authorization:token $GITHUB_API_TOKEN" -H "Content-Type:application/octet-stream" https://uploads.github.com/repos/mysteriumnetwork/dvpn-web/releases/$RELEASE_ID/assets?name=compatibility.json
only:
- tags
trigger-go-dvpn-web:
stage: trigger
tags: [docker]
script:
- apk add curl
- curl -X POST -F "token=$GO_DVPN_WEB_TRIGGER_TOKEN" -F "ref=master" -F "variables[GIT_TAG_VERSION]=$CI_COMMIT_TAG" https://gitlab.com/api/v4/projects/20001631/trigger/pipeline
only:
- tags