Deploy Documentation #9
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
name: Deploy Documentation | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
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 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
key: mkdocs-material-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs-material- | |
- name: Install dependencies and deploy | |
run: | | |
python -m pip install --upgrade pip --no-cache-dir | |
python -m pip install ."[docs]" --no-cache-dir | |
mkdocs gh-deploy --force | |
# name: Deploy Documentation | |
# on: | |
# workflow_dispatch: | |
# push: | |
# branches: | |
# - main | |
# jobs: | |
# deploy-docs: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout gh-pages | |
# uses: actions/checkout@v4 | |
# with: | |
# ref: gh-pages | |
# fetch-depth: 0 # Fetch all history for all branches and tags. | |
# - name: Fetch latest version | |
# run : | | |
# git fetch origin gh-pages | |
# LATEST_VERSION=$(git show gh-pages:versions.json | python -c "import sys, json; print(max([d['version'] for d in json.load(sys.stdin) if d['version']!='latest']))") | |
# - name: Checkout current branch | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 # Fetch all history for all branches and tags. | |
# - name: Markup Link Checker (mlc) | |
# uses: becheran/[email protected] | |
# with: | |
# args: docs | |
# - name: Set up Python | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: "3.10" | |
# - name: Install dependencies | |
# run: | | |
# python -m pip install --upgrade pip | |
# python -m pip install ."[docs]" | |
# - name: Extract versions and deploy if changed | |
# run: | | |
# CURRENT_VERSION=$(python -c "import iso_week_date; print(iso_week_date.__version__)") | |
# if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then | |
# mike deploy $CURRENT_VERSION latest | |
# mike set-alias latest $CURRENT_VERSION | |
# git config user.name 'GitHub Actions Bot' | |
# git config user.email '[email protected]' | |
# mike push | |
# fi |