digital-garden/.drone.yml

72 lines
2.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
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
environment:
GITHUB_SSH:
from_secret: GITHUB_SSH
commands:
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$GITHUB_SSH" >> ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git clone https://git.struchkov.dev/upagge/digital-garden.git /usr/src/app/content
- cd /usr/src/app/content
- git remote add github git@github.com:uPagge/digital-garden.git
- git push github
- cd /usr/src/app
- cp ./content/.quartz/quartz.config.ts .
- cp ./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
- tar czf - ./public/* | ssh -С -p $SSH_DEPLOY_PORT $SSH_DEPLOY_USER@$SSH_DEPLOY_HOST "cd $SSH_DEPLOY_PATH/ru-new && tar xzf -"
- ssh -p $SSH_DEPLOY_PORT $SSH_DEPLOY_USER@$SSH_DEPLOY_HOST "rm -rf $SSH_DEPLOY_PATH/ru/* && mv $SSH_DEPLOY_PATH/ru-new/* $SSH_DEPLOY_PATH/ru"
# drone sign --save upagge/digital-garden
---
kind: signature
hmac: 3d2b62aef4c7d90a04d656fdc67c1e074e6dd0dd2534119bb9b913f8e2881f1a
...