diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 804bc2c..c04a7e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: permissions: # Allow write access to the source code to enable GitHub Pages publishing. - contents: write + contents: read jobs: build-test: @@ -96,8 +96,6 @@ jobs: docs: name: Build documentation - permissions: - contents: read runs-on: ubuntu-22.04 steps: - name: Checkout the source code @@ -119,13 +117,25 @@ jobs: working-directory: ./docs run: flake8 . --exclude .venv - - name: Upload built documentation as an artifact - uses: actions/upload-artifact@v3 + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v3 with: - name: docs path: docs/build/html - if-no-files-found: error - retention-days: 1 + + deploy-docs: + if: github.event_name == 'push' && github.ref == 'refs/heads/staging' + environment: + name: github-pages + url: ${{ steps.github-pages.outputs.page_url }} + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v4 + id: github-pages build-finished: name: CI build successful @@ -136,19 +146,5 @@ jobs: - docs - license steps: - - name: Download built documentation for publishing - uses: actions/download-artifact@v3 - with: - name: docs - path: /tmp/docs - if: github.event_name == 'push' && github.ref == 'refs/heads/staging' - - - name: Publish the documentation to GitHub Pages - uses: ferrous-systems/shared-github-actions/github-pages@main - with: - path: /tmp/docs - token: ${{ secrets.GITHUB_TOKEN }} - if: github.event_name == 'push' && github.ref == 'refs/heads/staging' - - name: Mark the build as successful run: exit 0