Skip to content

Commit

Permalink
Split docs build / deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon committed Sep 30, 2023
1 parent 2ed1738 commit 7b4405e
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}

0 comments on commit 7b4405e

Please sign in to comment.