digital-garden/.drone.yml
Struchkov Mark 0128b1c894
All checks were successful
continuous-integration/drone/push Build is passing
cicd
2024-09-05 03:06:18 +03:00

60 lines
1.6 KiB
YAML

---
kind: pipeline
type: docker
name: docker-build-and-push
clone:
disable: true
trigger:
branch:
- master
image_pull_secrets:
- DOCKER_AUTH
steps:
- name: build site
# https://hub.docker.com/r/library/docker
pull: always
image: docker.struchkov.dev/quartz:develop
commands:
- rm -rf /usr/src/app/content
- git clone https://git.struchkov.dev/upagge/digital-garden.git /usr/src/app/content
- cd /usr/src/app
- mv ./content/.quartz/quartz.config.ts .
- mv ./content/.quartz/quartz.layout.ts .
- npx quartz build
- mv public /drone/src
- name: publish to server
image: private.docker.struchkov.dev/mkdocs:latest
environment:
SSH_DEPLOY_KEY:
from_secret: SSH_DEPLOY_KEY
SSH_DEPLOY_HOST:
from_secret: SSH_DEPLOY_HOST
SSH_DEPLOY_PORT:
from_secret: SSH_DEPLOY_PORT
SSH_DEPLOY_PATH:
from_secret: SSH_DEPLOY_PATH
SSH_DEPLOY_USER:
from_secret: SSH_DEPLOY_USER
commands:
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$SSH_DEPLOY_KEY" >> ~/.ssh/id_rsa
- chmod 700 ~/.ssh
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -p $SSH_DEPLOY_PORT $SSH_DEPLOY_HOST >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- ssh -p $SSH_DEPLOY_PORT $SSH_DEPLOY_USER@$SSH_DEPLOY_HOST "rm -rf $SSH_DEPLOY_PATH/*"
- scp -r -P $SSH_DEPLOY_PORT ./public/* $SSH_DEPLOY_USER@$SSH_DEPLOY_HOST:$SSH_DEPLOY_PATH
# drone sign --save upagge/digital-garden
---
kind: signature
hmac: a43e0084195f6e5d004f1c2525ca74884238e2882594143e3ec1f93fc4e63d70
...