name: Publish Documentation on: workflow_call: inputs: version: description: "Version to deploy (e.g., v0.16.0). Leave empty for dev." required: false type: string workflow_dispatch: inputs: version: description: "Version to deploy (e.g., v0.16.0). Leave empty for dev." required: false type: string push: branches: [main] paths: - docs/** - Makefile - build/mkdocs/** release: types: [published] permissions: contents: read # Set default read-only permissions jobs: build: name: Build & Deploy Documentation runs-on: ubuntu-latest permissions: contents: write actions: read steps: - name: Harden the Runner (Step Security) uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 with: egress-policy: audit - name: Checkout Repo uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: fetch-depth: 0 persist-credentials: false - name: Configure Git Credentials run: | git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Setup Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: cache: false go-version-file: go.mod - name: Set executable permissions for script run: chmod +x ./scripts/generate-service-config-docs.sh - name: Generate Service Config Docs run: | go mod download go clean -cache # Clear build cache ./scripts/generate-service-config-docs.sh - name: Build WASM module run: make wasm - name: Setup Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: "3.14.5" cache: "pip" cache-dependency-path: | build/mkdocs/docs-requirements.txt - name: Setup Cache uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: key: mkdocs-material-${{ hashFiles('build/mkdocs/docs-requirements.txt') }} path: .cache restore-keys: | mkdocs-material- - name: Install mkdocs run: | pip install -r build/mkdocs/docs-requirements.txt - name: Determine Mike Version and Aliases id: mike env: TAG_NAME: ${{ github.event.release.tag_name }} INPUT_VERSION: ${{ inputs.version }} run: | if [[ "${{ github.event_name }}" == "release" ]]; then echo "version=${TAG_NAME}" >> "$GITHUB_OUTPUT" echo "aliases=latest" >> "$GITHUB_OUTPUT" elif [[ -n "${INPUT_VERSION}" ]]; then echo "version=${INPUT_VERSION}" >> "$GITHUB_OUTPUT" echo "aliases=latest" >> "$GITHUB_OUTPUT" else echo "version=dev" >> "$GITHUB_OUTPUT" fi - name: Build and Deploy env: ALIASES: ${{ steps.mike.outputs.aliases }} VERSION: ${{ steps.mike.outputs.version }} run: | if [ -n "${ALIASES}" ]; then mike deploy \ --config-file build/mkdocs/mkdocs.yaml \ --push \ --update-aliases "${VERSION}" "${ALIASES}" else mike deploy \ --config-file build/mkdocs/mkdocs.yaml \ --push \ "${VERSION}" fi