Skip to content

Commit

Permalink
FIX/CI: switch docs deploy to dedicated gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly committed Oct 27, 2024
1 parent 9796f45 commit 116c57b
Showing 1 changed file with 31 additions and 37 deletions.
68 changes: 31 additions & 37 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ env:


jobs:
build_docs:
build:
if: (!contains(github.event.head_commit.message, '[skip-doc-build]')) || inputs.publish
name: Build Documentation
runs-on: ubuntu-latest
Expand Down Expand Up @@ -83,46 +83,40 @@ jobs:
run: |
git checkout ${{ github.sha }}
- name: Create doc build dir
run: |
mkdir -p docs/_build/html
- name: Checkout current docs
uses: actions/checkout@v4
with:
ref: gh-pages
path: docs/_build/html

- name: Build docs
run: |
mkdir test_cache # not really need but pytest setup relies on it
# delete all files in build directory, will be replaced with new
# build (don't use "make clean" as it deletes the .git folder)
# need to go to nested git repository in build directory
cd ./docs/_build/html
git rm -r *
# go back to docs folder in main repository
cd ../..
cd docs
make html
- name: Prepare docs for publishing
run: |
cd docs/_build/html
git add .
git config user.name github-actions
git config user.email [email protected]
git commit -m "$GITHUB_REF_NAME ($GITHUB_JOB) ci release"
- name: Publish docs
if: (github.event_name == 'release') || inputs.publish
run: |
git push origin gh-pages --force
- name: Upload docs as artifact
uses: actions/upload-artifact@v4
if: github.event_name != 'release'
uses: actions/upload-pages-artifact@v3
with:
name: Documentation Build
path: docs/_build/html
path: docs/_build/html/


deploy:
if: (github.event_name == 'release') || inputs.publish
name: Deploy Documentation

# Add a dependency to the build job
needs: build

# 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

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action


0 comments on commit 116c57b

Please sign in to comment.