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@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 with: egress-policy: audit - name: Checkout Repo uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 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@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.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@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.14.7" cache: "pip" cache-dependency-path: | build/mkdocs/docs-requirements.txt - name: Setup Cache uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 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