samsapti.dev/.drone.yml

45 lines
956 B
YAML

kind: pipeline
type: docker
name: build-and-deploy
steps:
- name: build
image: klakegg/hugo:alpine
volumes:
- name: data
path: /data
commands:
- apk add --no-cache git
- git submodule init
- git submodule update
- hugo -d /data/public
- name: deploy
image: alpine/git:latest
volumes:
- name: data
path: /data
environment:
SSH_USER:
from_secret: ssh_user
SSH_HOST:
from_secret: ssh_host
SSH_PORT:
from_secret: ssh_port
SSH_KEY:
from_secret: ssh_key
commands:
- mkdir ~/.ssh
- echo "$${SSH_KEY}" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- scp -o "StrictHostKeyChecking no" -P $${SSH_PORT} -r /data/public $${SSH_USER}@$${SSH_HOST}:docker/nginx/website
when:
branch:
- main
event:
exclude:
- pull_request
volumes:
- name: data
temp: {}