-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8c3a0c
commit 512ea3f
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Build and Deploy API docs and GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- ci/setup-semantic-release | ||
|
||
jobs: | ||
build-docs: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install and configure Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
- name: Load cached venv | ||
uses: actions/cache@v2 | ||
id: cached-poetry-dependencies | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: | | ||
poetry lock --no-update | ||
poetry install | ||
- name: Set up Quarto | ||
uses: quarto-dev/quarto-actions/setup@v2 | ||
|
||
- name: Run quartodoc | ||
run: | | ||
cd docs | ||
poetry run quartodoc build --verbose | ||
- name: Build site | ||
# if: ${{ github.ref == 'refs/heads/main' || startsWith(github.head_ref, 'ci') }} | ||
run: | | ||
cd docs | ||
poetry run quarto render | ||
- name: Upload site artifact | ||
# if: github.ref == 'refs/heads/main' | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: docs/_site | ||
|
||
deploy: | ||
if: github.ref == 'refs/heads/ci/setup-semantic-release' # TODO: Undo this | ||
needs: build-docs | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: docs/_site |