Skip to content

Commit 4efe38d

Browse files
committed
Fix 7 to push to a new branch
1 parent 256471a commit 4efe38d

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

.github/workflows/sphinx-docs.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
name: Build and Deploy Docs
1+
name: Documentation Build & Deploy
22

33
on:
44
push:
55
branches: [docs_publish]
66
pull_request:
77
branches: [docs_publish]
8+
workflow_dispatch:
89

910
jobs:
10-
deploy-docs:
11+
build-and-deploy:
1112
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pages: write
1216

1317
steps:
1418
- name: Checkout repository
@@ -17,26 +21,22 @@ jobs:
1721
- name: Set up Python
1822
uses: actions/setup-python@v5
1923
with:
20-
python-version: 3.12
24+
python-version: '3.12'
2125

2226
- name: Install dependencies
23-
run: pip install -r docs/requirements.txt
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -r docs/requirements.txt
2430
25-
- name: Build documentation
31+
- name: Build Sphinx documentation
2632
working-directory: docs
2733
run: make html
2834

29-
- name: Deploy to gen_page branch
30-
run: |
31-
git config user.name "github-actions[bot]"
32-
git config user.email "github-actions[bot]@users.noreply.github.com"
33-
34-
git fetch origin
35-
git switch --orphan gen_page
36-
37-
cp -r docs/build/html/* .
38-
touch .nojekyll
39-
40-
git add .
41-
git commit -m "Deploy documentation to gen_page"
42-
git push -f origin gen_page
35+
- name: Deploy to GitHub Pages (gen_page)
36+
uses: peaceiris/actions-gh-pages@v3
37+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
publish_dir: docs/build/html
41+
publish_branch: gen_page
42+
force_orphan: true

0 commit comments

Comments
 (0)