From f1a0149d66237de0c5693c2ba24e4d68f8aadcbc Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Tue, 30 Aug 2022 19:23:13 +0000 Subject: [PATCH] Rework deploy Build (test) on every commit Deploy only when pushing to master or main Add build caching (speed up repeat builds) --- .github/workflows/deploy.yml | 29 ++++++++++++++++++++++++----- .gitignore | 3 ++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 36e02ab6a..734e9190e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,12 +1,27 @@ -name: Deploy docs to GitHub Pages via mkdocs +name: Build mkdocs and deploy to GitHub Pages -on: - push: - branches: - - master +on: [push, pull_request] jobs: + + build: + name: Build docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - uses: actions/cache@v2 + with: + key: ${{ github.ref }} + path: .cache + - run: pip install -r docs/requirements.txt + - run: mkdocs build + deploy: + if: github.event_name == 'push' && contains(fromJson('["refs/heads/master", "refs/heads/main"]'), github.ref) + needs: build name: Deploy docs runs-on: ubuntu-latest steps: @@ -16,5 +31,9 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.x + - uses: actions/cache@v2 + with: + key: ${{ github.ref }} + path: .cache - run: pip install -r docs/requirements.txt - run: mkdocs gh-deploy --force diff --git a/.gitignore b/.gitignore index 6cab88bd4..6a3666d23 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -venv/ +.cache +venv/ mkdocs-dev-server.bat /docs/Notifiarr/preview.bat /docs/Notifiarr/Integrations/_TEMPLATE.md