Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: go-daraja tests
on:
[push]
push:
branches:
- '**'
paths-ignore:
- 'site/**'
jobs:
go-daraja-tests:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'docs/**'
- 'mkdocs.yml'
pull_request:
branches: [ "master" ]
branches: [ "master", "main" ]
paths:
- 'docs/**'
- 'mkdocs.yml'
Expand Down Expand Up @@ -37,12 +37,12 @@ jobs:
pip install mkdocs-material pymdown-extensions

- name: Build docs
run: mkdocs build --strict
run: mkdocs build --strict --site-dir site-build

- name: Upload built site artifact
uses: actions/upload-artifact@v4
with:
name: mkdocs-site
path: site
path: site-build
if-no-files-found: error
retention-days: 7
66 changes: 66 additions & 0 deletions .github/workflows/refresh-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Refresh built site on master/main

on:
push:
branches: [ "master", "main" ]
# Avoid infinite loops when the workflow commits only `site/` updates
paths-ignore:
- 'site/**'

concurrency:
group: refresh-site-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
refresh-site:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout repository

uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install MkDocs and theme
run: |
python -m pip install --upgrade pip
pip install mkdocs mkdocs-material pymdown-extensions

- name: Build docs to temporary directory
run: |
mkdocs --version
# Build to a separate directory so we can rsync into site/
mkdocs build --strict --site-dir site-build

- name: Atomically refresh site directory
run: |
# Ensure site directory exists
mkdir -p site
# Use rsync with --delete to remove stale files and copy only changes
rsync -a --delete site-build/ site/
rm -rf site-build

- name: Commit and push if site changed
env:
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: |
set -e
git add -A site
if git diff --staged --quiet; then
echo "No changes in site/, skipping commit."
exit 0
fi
git commit -m "chore(docs): refresh built site [skip ci]"
git push
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/silaselisha/go-daraja

go 1.22.0

require (
github.com/google/uuid v1.6.0
github.com/spf13/viper v1.20.1
Expand All @@ -10,7 +11,7 @@ require (
require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
Expand Down