Skip to content

Commit 9c9c363

Browse files
committed
Directly deploy (no force push into sep. branch)
1 parent 4af1f7b commit 9c9c363

File tree

1 file changed

+43
-19
lines changed

1 file changed

+43
-19
lines changed

.github/workflows/build_docs.yml

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,58 @@
1+
name: Build Docs
2+
13
on:
24
push:
35
branches:
46
- main
5-
permissions:
6-
contents: write
7+
78
jobs:
8-
deploy:
9-
runs-on: ubuntu-latest
9+
build:
10+
strategy:
11+
matrix:
12+
python-version: [ 3.11 ]
13+
os: [ ubuntu-latest ]
14+
runs-on: ${{ matrix.os }}
1015
steps:
11-
- uses: actions/checkout@v4
12-
- name: Configure Git Credentials
13-
run: |
14-
git config user.name github-actions[bot]
15-
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
16-
- uses: actions/setup-python@v5
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
1721
with:
18-
python-version: 3.x
19-
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
22+
python-version: ${{ matrix.python-version }}
2023

2124
- name: Install dependencies
2225
run: |
2326
python -m pip install --upgrade pip
2427
python -m pip install .
2528
python -m pip install -r docs/requirements.txt
29+
30+
- name: Build docs
31+
run: mkdocs build
2632

27-
- uses: actions/cache@v4
33+
- name: Upload docs
34+
uses: actions/upload-pages-artifact@v3
2835
with:
29-
key: mkdocs-material-${{ env.cache_id }}
30-
path: .cache
31-
restore-keys: |
32-
mkdocs-material-
33-
- run: pip install mkdocs-material
34-
- run: mkdocs gh-deploy --force
36+
path: site
37+
38+
# Deploy job
39+
deploy:
40+
# Add a dependency to the build job
41+
needs: build
42+
43+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
44+
permissions:
45+
pages: write # to deploy to Pages
46+
id-token: write # to verify the deployment originates from an appropriate source
47+
48+
# Deploy to the github-pages environment
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
53+
# Specify runner + deployment step
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action

0 commit comments

Comments
 (0)