-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
49 lines (43 loc) · 1.42 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
image: ubuntu:latest
before_script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -y openssh-client git
- mkdir -p $HOME/.ssh
- chmod 700 $HOME/.ssh
- rm -f $HOME/.ssh/known_hosts
- echo "$SSH_HOST ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDDoLhgavd5zWF8C+/BKlM15LNtpaaUkL03b44KYKxJ0DVf54zd6PO4pZxmZYorkNtsVHkOsJbXm2rmVrvdGBMU=" >> $HOME/.ssh/known_hosts
- ssh-keyscan -t rsa,dsa,ecdsa github.com >> $HOME/.ssh/known_hosts
- chmod 644 $HOME/.ssh/known_hosts
- eval $(ssh-agent -s)
- ssh-add -D
- echo -en "$SSH_KEY" | tr -d '\r' | ssh-add - > /dev/null
- ssh-add -l
stages:
- test
- deploy
test:
stage: test
script:
- DEBIAN_FRONTEND=noninteractive apt install -y rsync php-cli
- php index.php
deploy:
stage: deploy
script:
- DEBIAN_FRONTEND=noninteractive apt install -y rsync
- rsync -e "ssh" -avz --delete --exclude="\.*" * $SSH_USER@$SSH_HOST:$SSH_ROOT/
only:
- master
mirror-master:
script:
- git remote add upstream [email protected]:vician/nzmk || true
- git fetch upstream
- git push --force --progress upstream HEAD:master
only:
- master
mirror-tags:
script:
- git remote add upstream [email protected]:vician/nzmk || true
- git fetch upstream
- git push --force --progress --tags upstream HEAD:master
only:
- tags