-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
53 lines (48 loc) · 1.49 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
stages:
- lint
- 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
licenses_checker:
stage: lint
image: registry.gitlab.com/ai-r/cogment/license-checker:latest
script:
- license-checker
shellcheck:
image: koalaman/shellcheck-alpine:stable
stage: lint
before_script:
- shellcheck --version
script:
- shellcheck ./scripts/*.sh
shfmt:
image: mvdan/shfmt:v3.1.0-alpine
stage: lint
before_script:
- shfmt -version
script:
- shfmt -i 2 -ci -d ./scripts
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-tutorial-rps.git
- git fetch downstream ${CI_COMMIT_BRANCH}
- git push --tags downstream ${CI_COMMIT_BRANCH}:${CI_COMMIT_BRANCH}
only:
- main