Debian Codegraph @

.github/workflows/publish-docs.yaml

raw
1 name: Publish Documentation
2
3 on:
4 workflow_call:
5 inputs:
6 version:
7 description: "Version to deploy (e.g., v0.16.0). Leave empty for dev."
8 required: false
9 type: string
10 workflow_dispatch:
11 inputs:
12 version:
13 description: "Version to deploy (e.g., v0.16.0). Leave empty for dev."
14 required: false
15 type: string
16 push:
17 branches: [main]
18 paths:
19 - docs/**
20 - Makefile
21 - build/mkdocs/**
22 release:
23 types: [published]
24
25 permissions:
26 contents: read # Set default read-only permissions
27
28 jobs:
29 build:
30 name: Build & Deploy Documentation
31 runs-on: ubuntu-latest
32 permissions:
33 contents: write
34 actions: read
35 steps:
36 - name: Harden the Runner (Step Security)
37 uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
38 with:
39 egress-policy: audit
40
41 - name: Checkout Repo
42 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
43 with:
44 fetch-depth: 0
45 persist-credentials: false
46
47 - name: Configure Git Credentials
48 run: |
49 git config user.name github-actions[bot]
50 git config user.email 41898282+github-actions[bot]@users.noreply.github.com
51 git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
52 env:
53 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54
55 - name: Setup Go
56 uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
57 with:
58 cache: false
59 go-version-file: go.mod
60
61 - name: Set executable permissions for script
62 run: chmod +x ./scripts/generate-service-config-docs.sh
63
64 - name: Generate Service Config Docs
65 run: |
66 go mod download
67 go clean -cache # Clear build cache
68 ./scripts/generate-service-config-docs.sh
69
70 - name: Build WASM module
71 run: make wasm
72
73 - name: Setup Python
74 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
75 with:
76 python-version: "3.14.5"
77 cache: "pip"
78 cache-dependency-path: |
79 build/mkdocs/docs-requirements.txt
80
81 - name: Setup Cache
82 uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
83 with:
84 key: mkdocs-material-${{ hashFiles('build/mkdocs/docs-requirements.txt') }}
85 path: .cache
86 restore-keys: |
87 mkdocs-material-
88
89 - name: Install mkdocs
90 run: |
91 pip install -r build/mkdocs/docs-requirements.txt
92
93 - name: Determine Mike Version and Aliases
94 id: mike
95 env:
96 TAG_NAME: ${{ github.event.release.tag_name }}
97 INPUT_VERSION: ${{ inputs.version }}
98 run: |
99 if [[ "${{ github.event_name }}" == "release" ]]; then
100 echo "version=${TAG_NAME}" >> "$GITHUB_OUTPUT"
101 echo "aliases=latest" >> "$GITHUB_OUTPUT"
102 elif [[ -n "${INPUT_VERSION}" ]]; then
103 echo "version=${INPUT_VERSION}" >> "$GITHUB_OUTPUT"
104 echo "aliases=latest" >> "$GITHUB_OUTPUT"
105 else
106 echo "version=dev" >> "$GITHUB_OUTPUT"
107 fi
108
109 - name: Build and Deploy
110 env:
111 ALIASES: ${{ steps.mike.outputs.aliases }}
112 VERSION: ${{ steps.mike.outputs.version }}
113 run: |
114 if [ -n "${ALIASES}" ]; then
115 mike deploy \
116 --config-file build/mkdocs/mkdocs.yaml \
117 --push \
118 --update-aliases "${VERSION}" "${ALIASES}"
119 else
120 mike deploy \
121 --config-file build/mkdocs/mkdocs.yaml \
122 --push \
123 "${VERSION}"
124 fi