Deploy Documentation to GitHub Pages #46
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
# Simple workflow for deploying mkdocs site | |
name: Deploy Documentation to GitHub Pages | |
env: | |
gh-pages-url: https://ntno.github.io/mkdocs-terminal | |
pages-deployment: https://github.com/ntno/mkdocs-terminal/actions/workflows/pages/pages-build-deployment | |
# only one GitHub Pages Deploy workflow at a time | |
concurrency: | |
group: GitHub-Pages-Deploy | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Docs tag to deploy' | |
required: true | |
type: string | |
mkdocs-terminal-version: | |
description: 'with mkdocs-terminal version' | |
required: false | |
type: string | |
permissions: | |
contents: read | |
jobs: | |
report-inputs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Report Inputs | |
run: | | |
export MESSAGE="tag=${{ inputs.tag }}, mkdocs-terminal-version=${{ inputs.mkdocs-terminal-version }}" | |
echo "::notice title=Worfklow Inputs::$MESSAGE" | |
check-out-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.tag }} | |
call-metadata-workflow: | |
needs: [check-out-tag] | |
uses: ./.github/workflows/meta.yml | |
secrets: inherit | |
build-deploy-mkdocs: | |
needs: [check-out-tag, call-metadata-workflow] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.tag }} | |
- name: Install Explicitly Set mkdocs-terminal Version | |
run: | | |
if [[ "${{ inputs.mkdocs-terminal-version }}" == "" ]]; then | |
echo "no mkdocs-version override specified..." | |
else | |
pip install mkdocs-terminal==${{ inputs.mkdocs-terminal-version }} | |
fi | |
- name: Build MkDocs | |
run: | | |
cd documentation | |
make build-mkdocs | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./documentation/site | |
- name: Report Result | |
run: | | |
export BUILD_MESSAGE="${{ inputs.tag }} built with ${{ needs.call-metadata-workflow.outputs.build-tag }}" | |
echo "::notice title=GitHub Pages Built::$BUILD_MESSAGE" | |
export REVIEW_DEPLOY="review GitHub Pages Deployment at ${{ env.pages-deployment }}" | |
echo "::notice title=GitHub Pages Deployment Triggered::$REVIEW_DEPLOY" |