From c5e5de86f47c405db9acb3a2d582b2f587ab61ca Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Mon, 28 Nov 2022 00:36:48 +0000 Subject: [PATCH] Update gha --- .github/workflows/deploy.yml | 49 +++++++++++++++++++++++++++--------- .gitignore | 1 + 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bebb4f309..117947448 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,24 +1,49 @@ -name: Deploy docs to GitHub Pages via mkdocs +name: Build mkdocs and deploy to GitHub Pages -on: - push: - branches: - - mkdocs +on: [push, pull_request] jobs: - deploy: - name: Deploy docs + + build: + name: Build docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-python@v2.2.1 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.x + - uses: actions/cache@v3 + with: + key: ${{ github.ref }} + path: .cache - run: pip install -r docs/requirements.txt - - run: cp README.md docs/ - # temp line for test conversion repo - run: | + cp README.md docs/index.md cp -R general docs/ cp -R images docs/ cp -R FAQ.md docs/ - - run: mkdocs gh-deploy --force + - run: mkdocs build + + deploy: + if: github.event_name == 'push' && contains(fromJson('["refs/heads/master", "refs/heads/main", "refs/heads/mkdocs"]'), github.ref) + needs: build + name: Deploy docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: '0' + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - uses: actions/cache@v3 + with: + key: ${{ github.ref }} + path: .cache + - run: pip install -r docs/requirements.txt + - run: | + cp README.md docs/index.md + cp -R general docs/ + cp -R images docs/ + cp -R FAQ.md docs/ + - run: mkdocs gh-deploy --force \ No newline at end of file diff --git a/.gitignore b/.gitignore index 45ddf0ae3..bccd3dc6c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +.cache site/