Skip to content

Commit

Permalink
[infra] Use actions/deploy-pages to publish docs. (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec authored Nov 15, 2022
1 parent eabb84d commit 015eaa5
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ jobs:
password: ${{ secrets.PYPI_PYTKET_QUANTINUUM_API_TOKEN }}
verbose: true

docs:
name: Build and publish docs
build_docs:
name: Build docs
if: github.event_name == 'release'
needs: publish_to_pypi
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -138,20 +138,24 @@ jobs:
run: |
cd .github/workflows/docs
mkdir extensions
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "«$GITHUB_WORKFLOW» github action"
- name: Check out gh-pages branch
run: git checkout gh-pages
- name: Remove old docs
run: git rm -r --ignore-unmatch docs/api
- name: Add generated docs to repository
run: |
mkdir -p docs
mv .github/workflows/docs/extensions docs/api
git add -f docs/api
git commit --allow-empty -m "Add generated documentation."
- name: Publish docs
run: git push origin gh-pages:gh-pages
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions/api
- name: Upload docs as artefact
uses: actions/upload-pages-artifact@v1
with:
path: .github/workflows/docs/extensions

publish_docs:
name: Publish docs
if: github.event_name == 'release'
needs: build_docs
runs-on: ubuntu-22.04
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

0 comments on commit 015eaa5

Please sign in to comment.