ericxliu-me/.drone.yml

72 lines
1.7 KiB
YAML
Raw Normal View History

2023-08-27 03:26:41 +00:00
kind: pipeline
name: default
steps:
2023-09-18 02:40:54 +00:00
- name: git-clone
image: alpine/git
2023-09-18 02:44:50 +00:00
environment:
SSH_KEY:
from_secret: ssh_key
2023-09-18 02:40:54 +00:00
volumes:
- name: output
path: /output
commands:
2023-09-18 02:47:16 +00:00
- mkdir -p $HOME/.ssh
2023-09-18 02:44:50 +00:00
- echo "$SSH_KEY" > $HOME/.ssh/id_rsa
2023-09-18 03:47:50 +00:00
- chmod 400 $HOME/.ssh/id_rsa
2023-09-18 03:45:15 +00:00
- ssh-keyscan -H git.ericxliu.me > $HOME/.ssh/known_hosts
2023-09-18 02:40:54 +00:00
- git clone --branch gitea-pages git@git.ericxliu.me:eric/ericxliu-me.git /output
2023-09-18 04:10:15 +00:00
- find /output -mindepth 1 -not -regex "^.*\/.git.*" -delete
2023-09-18 04:20:01 +00:00
- name: submodules
image: alpine/git
commands:
- git submodule update --init --recursive
2023-08-27 03:26:41 +00:00
- name: build
image: plugins/hugo
2023-09-18 02:17:59 +00:00
volumes:
2023-09-18 02:34:55 +00:00
- name: output
2023-09-18 02:17:59 +00:00
path: /output
2023-08-27 03:26:41 +00:00
settings:
2023-08-27 03:51:04 +00:00
hugo_version: 0.97.0
extended: true
minify: true
2023-09-18 05:04:37 +00:00
url: "https://ericxliu.me"
2023-08-27 03:51:04 +00:00
validate: false
2023-09-18 04:54:32 +00:00
output: /output
2023-09-19 04:02:44 +00:00
- name: add-commit-hash
2023-09-18 01:50:41 +00:00
image: alpine/git
2023-09-18 02:17:59 +00:00
volumes:
2023-09-18 02:34:55 +00:00
- name: output
2023-09-18 02:17:59 +00:00
path: /output
2023-09-18 01:50:41 +00:00
commands:
2023-09-19 04:02:44 +00:00
- sed -i 's/\[commit\]/\[${DRONE_COMMIT_SHA:0:7}\]/g' layouts/partials/footer.html
2023-08-27 04:14:46 +00:00
- name: git-push
2023-09-11 02:40:22 +00:00
image: appleboy/drone-git-push:0.2.0-linux-amd64
2023-09-18 02:17:59 +00:00
volumes:
2023-09-18 02:34:55 +00:00
- name: output
2023-09-18 02:17:59 +00:00
path: /output
2023-08-27 04:14:46 +00:00
settings:
branch: gitea-pages
2023-09-11 02:37:00 +00:00
remote: "git@git.ericxliu.me:eric/ericxliu-me.git"
2023-08-27 04:14:46 +00:00
force: true
commit: true
2023-09-18 04:54:32 +00:00
path: /output
2023-08-27 04:14:46 +00:00
commit_message: "Drone build ${DRONE_COMMIT_SHA:0:7}"
author_name: "Eric Liu"
author_email: "eric@ericxliu.me"
ssh_key:
2023-09-18 02:17:59 +00:00
from_secret: ssh_key
2023-09-19 01:23:21 +00:00
- name: k8s-delete-pod
2023-09-19 01:33:27 +00:00
image: alpine/curl
2023-09-19 01:23:21 +00:00
environment:
TOKEN:
from_secret: token
2023-09-19 01:24:23 +00:00
APISERVER: "https://10.10.0.10:6443"
2023-09-19 01:23:21 +00:00
commands:
2023-09-19 01:31:56 +00:00
- "curl -X DELETE $APISERVER/api/v1/namespaces/hugo/pods/ --header \"Authorization: Bearer $TOKEN\" --insecure"
2023-09-18 02:17:59 +00:00
volumes:
- name: output
2023-09-18 05:35:02 +00:00
temp: {}
trigger:
branch:
- master