| 1 |
name: build-docs |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
branches: [ main ] |
| 6 |
paths: |
| 7 |
- '.github/workflows/**' |
| 8 |
- 'docs/**' |
| 9 |
- 'cmd/**' |
| 10 |
- 'core/**' |
| 11 |
- '*/CHANGELOG.md' |
| 12 |
- 'requirements.txt' |
| 13 |
workflow_dispatch: |
| 14 |
inputs: |
| 15 |
deploy: |
| 16 |
description: 'deploy the built docs' |
| 17 |
type: boolean |
| 18 |
default: false |
| 19 |
required: false |
| 20 |
|
| 21 |
jobs: |
| 22 |
build: |
| 23 |
name: Build Docs |
| 24 |
runs-on: ubuntu-latest |
| 25 |
steps: |
| 26 |
|
| 27 |
- name: Check out code |
| 28 |
uses: actions/checkout@v7 |
| 29 |
|
| 30 |
- name: Setup Go |
| 31 |
uses: actions/setup-go@v7 |
| 32 |
with: |
| 33 |
go-version-file: 'go.mod' |
| 34 |
|
| 35 |
- uses: actions/setup-python@v7 |
| 36 |
with: |
| 37 |
python-version: 3.x |
| 38 |
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV |
| 39 |
- uses: actions/cache@v6 |
| 40 |
with: |
| 41 |
key: mkdocs-material-${{ env.cache_id }} |
| 42 |
path: .cache |
| 43 |
restore-keys: | |
| 44 |
mkdocs-material- |
| 45 |
|
| 46 |
- name: Build docs |
| 47 |
run: | |
| 48 |
go run main.go gen |
| 49 |
pip install -r requirements.txt |
| 50 |
mkdocs build |
| 51 |
|
| 52 |
- name: Deploy Docs |
| 53 |
if: "${{ github.event.inputs.deploy }}" |
| 54 |
uses: peaceiris/[email protected] |
| 55 |
with: |
| 56 |
github_token: ${{ secrets.GITHUB_TOKEN }} |
| 57 |
publish_dir: ./site |
| 58 |
cname: changie.dev |