-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
36 lines (30 loc) · 1.04 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
image: clord/restedpi-ci
before_script:
- export DEBIAN_FRONTEND=noninteractive
stages:
- build
- deploy
build:
stage: build
artifacts:
paths:
- target/arm-unknown-linux-gnueabihf/release/restedpi
script:
- RUSTFLAGS='-L /root/tools/arm-bcm2708/arm-linux-gnueabihf/lib' cargo build --target=arm-unknown-linux-gnueabihf --release
deploy:
stage: deploy
only:
- master
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- ls target/arm-unknown-linux-gnueabihf/release
- rsync -hrvz --delete target/arm-unknown-linux-gnueabihf/release/restedpi $DEPLOY_USER@$DEPLOY_HOST:/usr/local/bin/restedpi
- ssh $DEPLOY_USER@$DEPLOY_HOST 'sudo systemctl restart restedpi'