Skip to content

Commit 18c5d4b

Browse files
making the ci.yml stronger
1 parent 55c0aa3 commit 18c5d4b

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,53 @@ name: Deploy Docs
33
on:
44
push:
55
branches:
6-
- main # Change this to your main branch name
6+
- main # Your main branch name
77

88
jobs:
9-
deploy:
9+
# 1. Build job: Create the MkDocs site and upload it as an artifact
10+
build:
1011
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write # Important: This grants permission to push to gh-pages
13-
1412
steps:
1513
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # Recommended for MkDocs when using specific themes/plugins
1616

1717
- name: Set up Python
1818
uses: actions/setup-python@v5
1919
with:
2020
python-version: '3.x'
2121

2222
- name: Install dependencies
23-
run: |
24-
pip install -r requirements.txt
23+
run: pip install -r requirements.txt
24+
25+
- name: Build MkDocs site
26+
# This command runs MkDocs and puts the output in the 'site' directory
27+
run: mkdocs build
28+
29+
- name: Upload artifact
30+
# This action uploads the 'site' directory for the Pages deployment job
31+
uses: actions/upload-pages-artifact@v3
32+
with:
33+
path: ./site
2534

35+
# 2. Deploy job: Take the uploaded artifact and publish it to GitHub Pages
36+
deploy:
37+
# This job must wait for the build job to complete successfully
38+
needs: build
39+
runs-on: ubuntu-latest
40+
41+
# 🛑 CRITICAL: Correct permissions for the new Pages Actions
42+
permissions:
43+
contents: read
44+
pages: write # Grants permission to create deployments
45+
id-token: write # Required for the OIDC token used by deploy-pages
46+
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
2650

27-
- name: Deploy MkDocs to GitHub Pages
28-
run: mkdocs gh-deploy --force
51+
steps:
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
# 🛑 CRITICAL: Use the official deployment action
55+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)