Split docs build / deploy workflow
This commit is contained in:
parent
2ed1738ee9
commit
7b4405ee35
1 changed files with 27 additions and 6 deletions
33
.github/workflows/docs-publish.yml
vendored
33
.github/workflows/docs-publish.yml
vendored
|
@ -11,8 +11,32 @@ permissions:
|
|||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
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: Docs Test Build
|
||||
run: MKINSIDERS=true 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
|
||||
|
@ -42,13 +66,10 @@ jobs:
|
|||
git pull origin gh-pages
|
||||
git checkout main
|
||||
- name: Docs Deploy for Main
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: MKINSIDERS=true mike deploy --update --push ${{github.ref_name}}
|
||||
- name: Docs Deploy for Tags
|
||||
if: github.event_name != 'pull_request' && github.ref != 'refs/heads/main'
|
||||
if: github.ref != 'refs/heads/main'
|
||||
run: MKINSIDERS=true mike deploy --update --push ${{github.ref_name}} latest
|
||||
- name: Docs Test Build
|
||||
if: github.event_name == 'pull_request'
|
||||
run: MKINSIDERS=true mkdocs build
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
|
|
Loading…
Add table
Reference in a new issue