Skip to content

Commit ed5b705

Browse files
committed
refactor: streamline GitHub Actions workflow for MkDocs deployment
1 parent 12ed250 commit ed5b705

File tree

1 file changed

+14
-49
lines changed

1 file changed

+14
-49
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 14 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,34 @@
1-
name: Deploy MkDocs to GitHub Pages
1+
name: build-mkdocs-gh-pages-branch
22

33
on:
44
push:
55
branches:
66
- main
7-
pull_request:
8-
branches:
9-
- main
10-
workflow_dispatch:
117

128
permissions:
13-
contents: read
14-
pages: write
15-
id-token: write
16-
17-
concurrency:
18-
group: "pages"
19-
cancel-in-progress: false
9+
contents: write
2010

2111
jobs:
22-
build:
12+
deploy:
2313
runs-on: ubuntu-latest
2414
steps:
25-
- name: Checkout
15+
- name: Checkout repository
2616
uses: actions/checkout@v4
2717
with:
28-
fetch-depth: 0 # Fetch full history for git-revision-date-localized plugin
18+
fetch-depth: 0 # Fetch all history for all branches and tags
2919

30-
- name: Setup Python
31-
uses: actions/setup-python@v4
20+
- uses: actions/setup-python@v5
3221
with:
3322
python-version: '3.x'
3423

35-
- name: Cache pip dependencies
36-
uses: actions/cache@v3
37-
with:
38-
path: ~/.cache/pip
39-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/pyproject.toml') }}
40-
restore-keys: |
41-
${{ runner.os }}-pip-
42-
4324
- name: Install dependencies
44-
run: |
45-
pip install --upgrade pip
46-
pip install mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin
25+
run: |
26+
pip install mkdocs-material mkdocs-git-revision-date-localized-plugin pymdown-extensions
4727
48-
- name: Setup Pages
49-
uses: actions/configure-pages@v3
28+
# - name: Generate changelog
29+
# run: git-cliff -c cliff.toml
5030

51-
- name: Build with MkDocs
52-
run: mkdocs build --strict
53-
54-
- name: Upload artifact
55-
uses: actions/upload-pages-artifact@v3
56-
with:
57-
path: ./site
58-
59-
deploy:
60-
environment:
61-
name: github-pages
62-
url: ${{ steps.deployment.outputs.page_url }}
63-
runs-on: ubuntu-latest
64-
needs: build
65-
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
66-
steps:
67-
- name: Deploy to GitHub Pages
68-
id: deployment
69-
uses: actions/deploy-pages@v2
31+
- name: Build and Deploy
32+
run: mkdocs gh-deploy --force
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)