Skip to content

Commit 4baab0d

Browse files
authored
Deploy pages directly from gh actions (#158)
* Deploy docs directly from CI * trigger ci * Allow manual trigger * Update README checklist * Yaml format
1 parent bfa1d5a commit 4baab0d

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

.github/workflows/docs.yaml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
name: Build and publish docs
22

33
permissions:
4-
contents: write
4+
contents: read
5+
pages: write
6+
id-token: write
7+
8+
concurrency:
9+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
10+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
11+
group: pages
12+
cancel-in-progress: false
513

614
on:
715
workflow_run:
@@ -10,11 +18,16 @@ on:
1018
- completed
1119
branches:
1220
- main
21+
workflow_dispatch:
22+
1323

1424
jobs:
1525
build-and-publish-docs:
1626
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1727
runs-on: ubuntu-latest
28+
environment:
29+
name: github-pages
30+
url: ${{ steps.deployment.outputs.page_url }}
1831
steps:
1932
- uses: actions/checkout@v4
2033
- name: Install uv
@@ -31,7 +44,12 @@ jobs:
3144
run: |
3245
APP_MODULE_NAME=$(ls src -U | head -1) # Get the first module name in the src directory
3346
uv run pdoc src/"$APP_MODULE_NAME" -o docs_build -t docs/pdoc-theme --docformat google
34-
touch docs_build/.nojekyll
35-
- uses: JamesIves/github-pages-deploy-action@v4
47+
- name: Setup Pages
48+
uses: actions/configure-pages@v5
49+
- name: Upload artifact
50+
uses: actions/upload-pages-artifact@v4
3651
with:
37-
folder: docs_build
52+
path: ./docs_build
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Welcome to the CMI-DAIR Template Python Repository! This template is designed to
1010
- [ ] Revise SECURITY.md to reflect supported versions or remove it if not applicable.
1111
- [ ] Remove the placeholder src and test files, these are there merely to show how the CI works.
1212
- [ ] If it hasn't already been done for your organization/acccount, grant third-party app permissions for CodeCov.
13-
- [ ] To set up an API documentation website, after the first successful build, go to the `Settings` tab of your repository, scroll down to the `GitHub Pages` section, and select `gh-pages` as the source. This will generate a link to your API docs.
13+
- [ ] To set up an API documentation website, go to the `Settings` tab of your repository, scroll down to the `GitHub Pages` section, and select `GitHub Actions` as the source. This will generate a link to your API docs.
1414
- [ ] Update stability badge in `README.md` to reflect the current state of the project. A list of stability badges to copy can be found [here](https://github.com/orangemug/stability-badges). The [node documentation](https://nodejs.org/docs/latest-v20.x/api/documentation.html#documentation_stability_index) can be used as a reference for the stability levels.
1515

1616
# Project name

0 commit comments

Comments
 (0)