CI: filter ci by paths, docs ci test vs build, update PR template

This commit is contained in:
shamoon 2023-09-30 10:10:22 -07:00
parent 56f46ae85c
commit a1e023e240
3 changed files with 44 additions and 7 deletions

View file

@ -4,14 +4,43 @@ on:
push:
tags: [ 'v*.*.*' ]
branches: ['main']
paths:
- 'docs/**'
- 'mkdocs.yml'
pull_request:
paths:
- 'docs/**'
- 'mkdocs.yml'
workflow_dispatch:
permissions:
contents: write
jobs:
test:
name: Test Build
if: github.repository == 'benphelps/homepage' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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 mkdocs-material
- name: Test Docs Build
run: MKINSIDERS=false mkdocs build
deploy:
if: github.repository == 'benphelps/homepage'
name: Build & Deploy
if: github.repository == 'benphelps/homepage' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -40,10 +69,10 @@ jobs:
git checkout gh-pages
git pull origin gh-pages
git checkout main
- name: Mike Deploy for Main
- name: Docs Deploy for Main
if: github.ref == 'refs/heads/main'
run: MKINSIDERS=true mike deploy --update --push ${{github.ref_name}}
- name: Mike Deploy for Tags
- name: Docs Deploy for Tags
if: github.ref != 'refs/heads/main'
run: MKINSIDERS=true mike deploy --update --push ${{github.ref_name}} latest
env: