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