Skip to content

Documentation: update docs ci test vs build, add tip to calendar docs #18

Documentation: update docs ci test vs build, add tip to calendar docs

Documentation: update docs ci test vs build, add tip to calendar docs #18

Workflow file for this run

name: Docs
on:
push:
tags: [ 'v*.*.*' ]
branches: ['main']
pull_request:
workflow_dispatch:
permissions:
contents: write
jobs:
test:
name: Test
if: github.repository == 'benphelps/homepage' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-python@v4
with:
python-version: 3.x
- 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-
- run: sudo apt-get install pngquant
- run: pip install mike
- run: pip install git+https://${GH_TOKEN}@github.com/benphelps/mkdocs-material-insiders.git
- name: Test Docs Build
run: MKINSIDERS=true mkdocs build
deploy:
name: Build & Deploy
if: github.repository == 'benphelps/homepage' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-python@v4
with:
python-version: 3.x
- 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-
- run: sudo apt-get install pngquant
- run: pip install mike
- run: pip install git+https://${GH_TOKEN}@github.com/benphelps/mkdocs-material-insiders.git
- name: Set Git config
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
- name: Sync gh-pages
run: |
git fetch origin gh-pages
git checkout gh-pages
git pull origin gh-pages
git checkout main
- name: Docs Deploy for Main
if: github.ref == 'refs/heads/main'
run: MKINSIDERS=true mike deploy --update --push ${{github.ref_name}}
- name: Docs Deploy for Tags
if: github.ref != 'refs/heads/main'
run: MKINSIDERS=true mike deploy --update --push ${{github.ref_name}} latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}