Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.

Commit 504a8df

Browse files
authored
Merge pull request #51 from silaselisha/develop
Develop
2 parents 9836136 + 5675426 commit 504a8df

3 files changed

Lines changed: 75 additions & 5 deletions

File tree

.github/workflows/cicd.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: go-daraja tests
22
on:
3-
[push]
3+
push:
4+
branches:
5+
- '**'
6+
paths-ignore:
7+
- 'site/**'
48
jobs:
59
go-daraja-tests:
610
runs-on: ubuntu-latest

.github/workflows/docs-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: Build docs (MkDocs)
22

33
on:
44
push:
5-
branches: [ "dev" ]
5+
branches: [ "develop" ]
66
paths:
77
- 'docs/**'
88
- 'mkdocs.yml'
99
pull_request:
10-
branches: [ "master" ]
10+
branches: [ "master", "main" ]
1111
paths:
1212
- 'docs/**'
1313
- 'mkdocs.yml'
@@ -37,12 +37,12 @@ jobs:
3737
pip install mkdocs-material pymdown-extensions
3838
3939
- name: Build docs
40-
run: mkdocs build --strict
40+
run: mkdocs build --strict --site-dir site-build
4141

4242
- name: Upload built site artifact
4343
uses: actions/upload-artifact@v4
4444
with:
4545
name: mkdocs-site
46-
path: site
46+
path: site-build
4747
if-no-files-found: error
4848
retention-days: 7

.github/workflows/refresh-site.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Refresh built site on master/main
2+
3+
on:
4+
push:
5+
branches: [ "master", "main" ]
6+
# Avoid infinite loops when the workflow commits only `site/` updates
7+
paths-ignore:
8+
- 'site/**'
9+
10+
concurrency:
11+
group: refresh-site-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
refresh-site:
19+
if: github.actor != 'github-actions[bot]'
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Setup Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: '3.x'
32+
33+
- name: Install MkDocs and theme
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install mkdocs mkdocs-material pymdown-extensions
37+
38+
- name: Build docs to temporary directory
39+
run: |
40+
mkdocs --version
41+
# Build to a separate directory so we can rsync into site/
42+
mkdocs build --strict --site-dir site-build
43+
44+
- name: Atomically refresh site directory
45+
run: |
46+
# Ensure site directory exists
47+
mkdir -p site
48+
# Use rsync with --delete to remove stale files and copy only changes
49+
rsync -a --delete site-build/ site/
50+
rm -rf site-build
51+
52+
- name: Commit and push if site changed
53+
env:
54+
GIT_AUTHOR_NAME: github-actions[bot]
55+
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
56+
GIT_COMMITTER_NAME: github-actions[bot]
57+
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
58+
run: |
59+
set -e
60+
git add -A site
61+
if git diff --staged --quiet; then
62+
echo "No changes in site/, skipping commit."
63+
exit 0
64+
fi
65+
git commit -m "chore(docs): refresh built site [skip ci]"
66+
git push

0 commit comments

Comments
 (0)