Skip to content

Commit

Permalink
GitHub broke and deprecated gh-pages branch 8h ago, switch to GitHub …
Browse files Browse the repository at this point in the history
  • Loading branch information
aeisenbarth committed Jun 28, 2024
1 parent 9bcfcfc commit 11091f4
Showing 1 changed file with 35 additions and 36 deletions.
71 changes: 35 additions & 36 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
# Simple workflow for deploying static content to GitHub Pages
name: Build docs

on:
# Runs on pushes targeting the default branch
push:
branches:
- "*"
# branches: ["main"]
branches: ["*"]

jobs:
sphinx_docs_to_gh-pages:
name: Sphinx docs to gh-pages
runs-on: ubuntu-latest
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

permissions:
contents: write
pages: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -28,29 +43,13 @@ jobs:
run: pdm sync
- name: Build docs
run: pdm docs
- name: Create .nojekyll in case 'sphinx.ext.githubpages' is not used
run: touch "docs/_build/.nojekyll"
- name: Set the committer name and email
run: |
author_name="$(git show --format=%an -s)"
author_email="$(git show --format=%ae -s)"
git config user.name "$author_name"
git config user.email "$author_email"
- name: Create gh-pages branch if needed
run: |
if [[ -z "$(git ls-remote --heads origin gh-pages)" ]]; then
echo "Creating gh-pages branch"
git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "First commit to create gh-pages branch"
git push origin gh-pages
echo "Created gh-pages branch"
git checkout "$GITHUB_REF"
else
echo "Branch gh-pages already exists"
fi
- name: Commit to gh-pages branch and push
run: |
git add -f "docs/_build/"
git commit -m "From $GITHUB_REF $GITHUB_SHA"
git push origin `git subtree split --prefix "docs/_build/" "$GITHUB_REF"`:gh-pages --force
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload docs build directory
path: 'docs/_build/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 11091f4

Please sign in to comment.