From b855afa0bb4de0b721963edbfa4d782dd7d93938 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 25 Sep 2022 17:08:06 -0500 Subject: [PATCH] docs: use peaceiris action --- .github/workflows/docs.yml | 51 +++++++++++++++++++++++++++++++------- requirements-docs.txt | 2 ++ 2 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 requirements-docs.txt diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 714e1d2..279cc16 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,19 +1,52 @@ -name: docs +name: GitHub Pages + on: push: branches: - main + jobs: deploy: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-python@v2 - with: - python-version: 3.x - - run: pip install mkdocs-material \ - mkdocs-git-revision-date-localized-plugin - - run: mkdocs gh-deploy --force + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: '3.9' + + - name: Upgrade pip + run: | + # install pip=>20.1 to use "pip cache dir" + python3 -m pip install --upgrade pip + + - name: Get pip cache dir + id: pip-cache + run: echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-docs.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install dependencies + run: python3 -m pip install -r ./requirements-docs.txt + + - run: mkdocs build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.ref == 'refs/heads/main' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./site diff --git a/requirements-docs.txt b/requirements-docs.txt new file mode 100644 index 0000000..8fdf8ba --- /dev/null +++ b/requirements-docs.txt @@ -0,0 +1,2 @@ +mkdocs-material +mkdocs-git-revision-date-localized-plugin