Build Docs and Publish to gh-pages #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#==================================================================================================== | |
## Process | |
# 1. When changes are made to documentation files and pushed to the main branch, the workflow in this file is triggered. | |
# 2. Copy the repository's contents to the runner, so the workflow can access them. | |
# 3. Run a script that sets the version number. | |
# 4. `make docs-build` is run within a Docker container to build the documentation . | |
# 5. `make docs-deploy` is run inside Docker container to deploy the documentation to GitHub Pages. | |
#==================================================================================================== | |
name: Build Docs and Publish to gh-pages | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "docs/**" | |
- "mkdocs.yml" | |
- "CHANGELOG.md" | |
- "**/README.md" | |
- ".github/workflows/docs.yml" | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version to build and publish docs (i.e. 0.1.0-alpha.1, latest)" | |
required: true | |
type: string | |
alias: | |
description: "Alias to associate version (latest, stage)" | |
required: true | |
type: string | |
git_ref: | |
description: "Branch or commit ID to checkout from" | |
required: false | |
type: string | |
default: main | |
permissions: | |
contents: write | |
jobs: | |
publish_docs: | |
if: github.repository == 'aws-games/cloud-game-development-toolkit' | |
concurrency: | |
group: docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ inputs.git_ref }} | |
- name: Git client setup | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
- name: Set version | |
run: | | |
echo "Tag name from github.ref_name: ${{ github.ref_name }}" | |
echo "VERSION is: ${{ inputs.version }}" | |
echo "ALIAS is: ${{ inputs.alias }}" | |
- name: Build docs | |
run: make docs-build VERSION=$RELEASE_VERSION | |
- name: Deploy Docs | |
run: make docs-deploy VERSION="$RELEASE_VERSION" ALIAS="$ALIAS" | |