BeerHolderBot/.gitlab-ci.yml

48 lines
921 B
YAML

image: rust
stages:
- build
- test
- deploy
build:
stage: build
cache:
key: one-key-to-rule-them-all
paths:
- target
script:
- cargo build
lint:
stage: test
cache:
key: one-key-to-rule-them-all
paths:
- target
script:
- rustup component add clippy
- cargo clippy --all-targets --all-features
test:
stage: test
cache:
key: one-key-to-rule-them-all
paths:
- target
script:
- cargo test
deploy:
stage: deploy
dependencies:
- test
script:
- mkdir ~/.ssh
- eval $(ssh-agent -s)
- echo "$SSH_KEY" | ssh-add -
- ssh-keyscan -H -t rsa ssh.api.ericlondres.tech >> ~/.ssh/known_hosts
- ssh -t root@ssh.api.ericlondres.tech "cd /root/packages/bot/BeerHolderBot; git pull origin master; bash --login -c 'gpg --passphrase $GPG_PASS --decrypt secret.sh.gpg > secret.sh; source secret.sh; exit 0'"
only:
- master