Skip to content

Commit 2551b09

Browse files
authored
add W
1 parent 1cc7f6b commit 2551b09

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,55 @@
1+
name: ci
12

3+
on:
4+
workflow_run:
5+
workflows:
6+
- generate-markdown-files
7+
types:
8+
- completed
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
if: |
18+
github.event_name == 'workflow_dispatch' ||
19+
(
20+
github.event.workflow_run.conclusion == 'success' &&
21+
github.event.workflow_run.head_commit.message == 'Update generated markdown files'
22+
)
23+
steps:
24+
# Step 1: Checkout the repository
25+
- uses: actions/checkout@v4
26+
27+
# Step 2: Configure Git credentials
28+
- name: Configure Git Credentials
29+
run: |
30+
git config user.name github-actions[bot]
31+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
32+
33+
# Step 3: Set up Python environment
34+
- uses: actions/setup-python@v5
35+
with:
36+
python-version: 3.x
37+
38+
# Step 4: Cache dependencies
39+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
40+
- uses: actions/cache@v4
41+
with:
42+
key: mkdocs-material-${{ env.cache_id }}
43+
path: .cache
44+
restore-keys: |
45+
mkdocs-material-
46+
47+
# Step 5: Install MkDocs and plugins
48+
- name: Install MkDocs and Plugins
49+
run: |
50+
pip install mkdocs-material
51+
pip install mkdocs-static-i18n
52+
53+
# Step 6: Build and deploy to GitHub Pages
54+
- name: Build and deploy to GitHub Pages
55+
run: mkdocs gh-deploy --force
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: generate-markdown-files
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
generate-markdown:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# Step 1: Check out the repository
15+
- name: Check out repository
16+
uses: actions/checkout@v3
17+
18+
# Step 2: Set up Python
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.x'
23+
24+
# Step 3: Install dependencies
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
# Currently unused
29+
30+
# Step 4: Run the script
31+
- name: Generate markdown files
32+
run: python generate_markdown.py
33+
34+
# Step 5: Push changes back to the repository
35+
- name: Commit and push changes
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
run: |
39+
git config --global user.name "github-actions[bot]"
40+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
41+
git add docs/
42+
git commit -m "Update generated markdown files" || echo "No changes to commit"
43+
git push origin main

0 commit comments

Comments
 (0)