-
Notifications
You must be signed in to change notification settings - Fork 10
42 lines (40 loc) · 1.24 KB
/
compile-and-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: 编译并部署
on:
workflow_dispatch:
jobs:
compile-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 检出
uses: actions/checkout@v4
- name: 编译
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends zip
docker run --rm -v ${PWD}:/docs registry-hk.fit2cloud.com/public/mkdocs-material:latest build
zip -r -q -9 site.zip site
ls -la site.zip
- name: 上传
uses: appleboy/[email protected]
with:
host: ${{ secrets.MAXKB_DOCS_HOST }}
username: ${{ secrets.MAXKB_DOCS_HOST_USERNAME }}
port: 22
key: ${{ secrets.MAXKB_DOCS_HOST_KEY }}
source: "site.zip"
target: /tmp
- name: 部署
uses: appleboy/[email protected]
with:
host: ${{ secrets.MAXKB_DOCS_HOST }}
username: ${{ secrets.MAXKB_DOCS_HOST_USERNAME }}
key: ${{ secrets.MAXKB_DOCS_HOST_KEY }}
port: 22
script: |
cd /tmp
rm -rf site
unzip site.zip
rm -rf /opt/maxkb/docs/*
mv /tmp/site/* /opt/maxkb/docs
/opt/nginx/bin/reload-nginx.sh
rm -rf /tmp/site*