Files
altherego/.drone.yml
2021-01-06 02:19:09 +03:00

44 lines
1.2 KiB
YAML

---
kind: pipeline
type: docker
name: build-check-deploy
platform:
os: "linux"
arch: "arm"
steps:
# Fetch deps and check the code
- name: "validate"
image: "rust:1.49"
volumes:
- name: "cache"
path: "/.target"
commands:
- "apt-get update && apt-get install -yqq musl-tools"
- "rustup target add armv7-unknown-linux-musleabihf"
- "CC=musl-gcc cargo check --release --target=armv7-unknown-linux-musleabihf"
- "CC=musl-gcc cargo test --release --target=armv7-unknown-linux-musleabihf"
- "CC=musl-gcc cargo build --release --target=armv7-unknown-linux-musleabihf"
# Deploy it somewhere.
- name: "deploy"
image: "rust:1.49"
depends_on:
- "validate"
environment:
SSH_PK:
from_secret: SSH_PRIVATE_KEY
SSH_PARAMS: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/tmp/known_hosts'
TARGET_DIR: "./.target/armv7-unknown-linux-musleabihf/release"
commands:
- "mkdir /tmp/ssh 2>&1"
- "echo -n ${SSH_PK} | base64 -d > /tmp/ssh/deploy_key "
- "eval $(ssh-agent -s)"
- "chmod 600 /tmp/ssh/deploy_key"
- "ssh-add /tmp/ssh/deploy_key"
- "scp ${SSH_PARAMS} ${TARGET_DIR}/alterego ${SSH_USER}@${SSH_HOST}:/home/pi/alterego"
volumes:
- name: "cache"
temp: {}