From 7b4405ee35bb6d155a53d2c4badf1b6c84a0e5f8 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 30 Sep 2023 10:20:25 -0700 Subject: [PATCH] Split docs build / deploy workflow --- .github/workflows/docs-publish.yml | 33 ++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index ff174cf8e83..761aaece7fb 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -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 }}