-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(hugr-py): build and publish docs (#1253)
Closes #1215 Will build and publish for main branch + every tagged version with docs (currently none), using [sphinx-multiversion](https://holzhaus.github.io/sphinx-multiversion/master/index.html) With multiple versions looks like: ![image](https://github.com/CQCL/hugr/assets/12997250/f54738cf-d38f-4be7-a370-e34ab986482b) Will follow-up with a PR adding links to readme etc. once I've seen the workflow succeeds.
- Loading branch information
Showing
7 changed files
with
112 additions
and
3 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,63 @@ | ||
name: Build and publish docs | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
# only run if there are changes in the hugr-py directory | ||
paths: | ||
- 'hugr-py/**' | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run | ||
# in-progress and latest queued. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Build docs. | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./hugr-py | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install poetry | ||
run: pipx install poetry | ||
- name: Set up Python '3.10' | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
cache: "poetry" | ||
- name: Install HUGR | ||
run: poetry install --with docs | ||
- name: Build docs | ||
run: | | ||
cd docs | ||
./build.sh | ||
- name: Upload artifact. | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./hugr-py/docs/build | ||
|
||
publish: | ||
name: Publish docs. | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Deploy to GitHub Pages. | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Redirecting to main branch</title> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="refresh" content="0; url=./main/index.html"> | ||
<link rel="canonical" href="https://cqcl.github.io/hugr/main/index.html"> | ||
</head> | ||
</html> |
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,8 @@ | ||
{% if versions %} | ||
<h3>{{ _('Versions') }}</h3> | ||
<ul> | ||
{%- for item in versions %} | ||
<li><a href="{{ item.url }}">{{ item.name }}</a></li> | ||
{%- endfor %} | ||
</ul> | ||
{% endif %} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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