53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
name: Build and Deploy Documentation
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: docs-deploy
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-act-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: readout_program
|
|
|
|
steps:
|
|
- name: Checkout readout_program
|
|
uses: https://gitee.com/actions-mirror/checkout@v4
|
|
with:
|
|
path: readout_program
|
|
|
|
- name: Checkout rbpu_datasheet
|
|
uses: https://gitee.com/actions-mirror/checkout@v4
|
|
with:
|
|
repository: ${{ github.repository_owner }}/rbpu_datasheet
|
|
path: rbpu_datasheet
|
|
|
|
- name: Configure pip mirror
|
|
run: pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
|
|
|
- name: Install dependencies
|
|
run: pip install --retries 3 -r requirements.txt
|
|
|
|
- name: Build documentation
|
|
run: python build.py
|
|
|
|
- name: Deploy to Caddy
|
|
env:
|
|
WEBDAV_URL: ${{ secrets.WEBDAV_URL }}
|
|
WEBDAV_USER: ${{ secrets.WEBDAV_USER }}
|
|
WEBDAV_PASS: ${{ secrets.WEBDAV_PASS }}
|
|
run: |
|
|
for f in output/*.html; do
|
|
echo "上传: $(basename "$f") → /manual/manual-readout-program.html"
|
|
curl -sS --retries 3 -u "${WEBDAV_USER}:${WEBDAV_PASS}" \
|
|
-T "$f" "${WEBDAV_URL}/manual/manual-readout-program.html"
|
|
done
|
|
echo "部署完成"
|