ericxliu-me/.drone.yml
eric Liu a05c44d488
All checks were successful
continuous-integration/drone Build is passing
Update .drone.yml
2023-09-19 04:02:44 +00:00

72 lines
1.7 KiB
YAML

kind: pipeline
name: default
steps:
- name: git-clone
image: alpine/git
environment:
SSH_KEY:
from_secret: ssh_key
volumes:
- name: output
path: /output
commands:
- mkdir -p $HOME/.ssh
- echo "$SSH_KEY" > $HOME/.ssh/id_rsa
- chmod 400 $HOME/.ssh/id_rsa
- ssh-keyscan -H git.ericxliu.me > $HOME/.ssh/known_hosts
- git clone --branch gitea-pages git@git.ericxliu.me:eric/ericxliu-me.git /output
- find /output -mindepth 1 -not -regex "^.*\/.git.*" -delete
- name: submodules
image: alpine/git
commands:
- git submodule update --init --recursive
- name: build
image: plugins/hugo
volumes:
- name: output
path: /output
settings:
hugo_version: 0.97.0
extended: true
minify: true
url: "https://ericxliu.me"
validate: false
output: /output
- name: add-commit-hash
image: alpine/git
volumes:
- name: output
path: /output
commands:
- sed -i 's/\[commit\]/\[${DRONE_COMMIT_SHA:0:7}\]/g' layouts/partials/footer.html
- name: git-push
image: appleboy/drone-git-push:0.2.0-linux-amd64
volumes:
- name: output
path: /output
settings:
branch: gitea-pages
remote: "git@git.ericxliu.me:eric/ericxliu-me.git"
force: true
commit: true
path: /output
commit_message: "Drone build ${DRONE_COMMIT_SHA:0:7}"
author_name: "Eric Liu"
author_email: "eric@ericxliu.me"
ssh_key:
from_secret: ssh_key
- name: k8s-delete-pod
image: alpine/curl
environment:
TOKEN:
from_secret: token
APISERVER: "https://10.10.0.10:6443"
commands:
- "curl -X DELETE $APISERVER/api/v1/namespaces/hugo/pods/ --header \"Authorization: Bearer $TOKEN\" --insecure"
volumes:
- name: output
temp: {}
trigger:
branch:
- master