Add mkdocs publish support #215
This file contains hidden or 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
| name: main-deploy | ||
| # Controls when the workflow will run | ||
| on: | ||
| # Triggers the workflow on push events for the main branch | ||
| push: | ||
| branches: [ main ] | ||
| # Allows you to run this workflow manually from the Actions tab | ||
| workflow_dispatch: | ||
| # Needs write permission to update the gh-pages branch that is used for GitHub Pages | ||
| permissions: | ||
| contents: write | ||
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
| jobs: | ||
| # This workflow contains a single job called "deploy" | ||
| # Copied from https://squidfunk.github.io/mkdocs-material/publishing-your-site/ | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Configure Git Credentials | ||
| run: | | ||
| git config user.name github-actions[bot] | ||
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: 3.x | ||
| - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
| - uses: actions/cache@v4 | ||
| with: | ||
| key: mkdocs-material-${{ env.cache_id }} | ||
| path: .cache | ||
| restore-keys: | | ||
| mkdocs-material- | ||
| - run: pip install mkdocs-material mkdocs-material-extensions pymdown-extensions | ||
| - run: mkdocs gh-deploy --force | ||
| name: push-preview | ||
| on: | ||
| # Triggers on pull request branch when it is marked ready for review | ||
| pull_request: | ||
| type: [ready_for_review] | ||
| # Allows you to run this workflow manually from the Actions tab | ||
| workflow_dispatch: | ||
| # Needs write permission to update the gh-pages branch that is used for GitHub Pages | ||
| permissions: | ||
| contents: write | ||
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
| jobs: | ||
| # This workflow contains a single job called "preview" | ||
| # This deploys PR content to a preview sub-directory | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Configure Git Credentials | ||
| run: | | ||
| git config user.name github-actions[bot] | ||
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: 3.x | ||
| - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
| - uses: actions/cache@v4 | ||
| with: | ||
| key: mkdocs-material-${{ env.cache_id }} | ||
| path: .cache | ||
| restore-keys: | | ||
| mkdocs-material- | ||
| - run: pip install mkdocs-material mkdocs-material-extensions pymdown-extensions | ||
| - run: mkdocs gh-deploy -v -d preview/ --force | ||