-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
74 lines (67 loc) · 2.52 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
stages:
- build
- build-docker
- deploy
pages:
stage: build
image: ubuntu:22.04
only:
- master
script:
- apt-get update -y
- apt-get install -y python3-venv build-essential git curl doxygen
- curl -LO https://julialang-s3.julialang.org/bin/linux/x64/1.1/julia-1.1.0-linux-x86_64.tar.gz
- tar xzf julia-*.tar.gz
- rm -rf julia-*.tar.gz
- mv julia-* /usr/local/julia
- ln -s /usr/local/julia/bin/julia /usr/local/bin/julia
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
- export PATH=~/.cargo/bin:"${PATH}"
- git submodule update --init
- make
- mv build public
artifacts:
paths:
- public
build-docker:
stage: build-docker
image: docker:stable
only:
- branches@Scientific-IT-Systems/gr-documentation
- tags@Scientific-IT-Systems/gr-documentation
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- if docker pull $CI_REGISTRY_IMAGE:latest; then docker tag $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:previous; docker push $CI_REGISTRY_IMAGE:previous; fi
- docker build -t $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:latest
deploy:
stage: deploy
image: ubuntu:latest
only:
- master@Scientific-IT-Systems/gr-documentation
- tags@Scientific-IT-Systems/gr-documentation
script:
- apt update
- apt install -y ssh
- mkdir -p --mode=700 ~/.ssh/
- echo "$DEPLOYMENT_PRIVATE_KEY" > ~/.ssh/deployment_key
- chmod 400 ~/.ssh/deployment_key
- echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts
- chmod 400 ~/.ssh/known_hosts
- echo -e "$CI_JOB_TOKEN\n$CI_REGISTRY_IMAGE:latest\n$CI_PROJECT_NAME" | ssh -i ~/.ssh/deployment_key [email protected]
deploy-to-github:
stage: deploy
image: ubuntu:20.04
variables:
GIT_STRATEGY: none
only:
- master@Scientific-IT-Systems/gr-documentation
- tags@Scientific-IT-Systems/gr-documentation
script:
- apt-get update
- apt-get install -y git
- mkdir --mode=700 ~/.ssh/
- (umask 0377 && echo "$SCIAPP_GR_DOCUMENTATION_PRIVATE_KEY" > ~/.ssh/id_rsa
&& echo "github.com $GITHUB_HOST_KEY" >> ~/.ssh/known_hosts)
- git clone --mirror "$CI_REPOSITORY_URL" gr_documentation_mirror
- cd gr_documentation_mirror && git push --mirror [email protected]:sciapp/gr-documentation.git && cd -