Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Github Pages action #5

Merged
merged 6 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 18 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -96,8 +96,6 @@ jobs:

docs:
name: Build documentation
permissions:
contents: read
runs-on: ubuntu-22.04
steps:
- name: Checkout the source code
Expand All @@ -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
Expand All @@ -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
Loading