-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
69 lines (62 loc) · 1.79 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
stages:
- lint
- build
- publish
.base_gh_ssh_agent:
before_script:
## _Inspired by https://docs.gitlab.com/ee/ci/ssh_keys/_
##
## Install ssh-agent if not already installed.
- "command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )"
## Run ssh-agent
- eval $(ssh-agent -s)
## Add the private key file to ssh-agent
- echo "$GH_REPO_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
## Create the SSH directory and give it the right permissions
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
## Using the set $SSH_KNOWN_HOSTS to be able to verify remote servers public keys
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
image: node:18
# Cache modules in between jobs
cache:
key:
files:
- package-lock.json
paths:
- .npm/
licenses_checker:
stage: build
needs: []
image: registry.gitlab.com/ai-r/cogment/license-checker:latest
script:
- license-checker
build:
stage: build
script:
- npm ci --cache .npm --prefer-offline
- npm run build
except:
# build is included in the npm run deploy executed on main
- main
publish:
extends: .base_gh_ssh_agent
stage: publish
script:
- npm ci --cache .npm --prefer-offline
- git config --global user.email "[email protected]"
- git config --global user.name "AI Redefined Inc."
- USE_SSH=true npm run deploy
only:
- main
publish_branch_to_github:
extends: .base_gh_ssh_agent
stage: publish
script:
- git checkout ${CI_COMMIT_BRANCH} # Checkout the branch not the sha1
- git remote add downstream [email protected]:cogment/cogment-doc.git
- git fetch downstream ${CI_COMMIT_BRANCH}
- git push --tags downstream ${CI_COMMIT_BRANCH}:${CI_COMMIT_BRANCH}
only:
- main