ci: forgejo actions workflow to build zensical and deploy to pages
This commit is contained in:
parent
c5baca9195
commit
54e74a0f04
1 changed files with 45 additions and 0 deletions
45
.forgejo/workflows/docs.yml
Normal file
45
.forgejo/workflows/docs.yml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
name: Deploy Docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- run: pip install zensical
|
||||
|
||||
- run: zensical build --clean
|
||||
|
||||
- name: Deploy to pages branch
|
||||
run: |
|
||||
set -e
|
||||
git config user.name "forgejo-actions"
|
||||
git config user.email "forgejo-actions@noreply.local"
|
||||
|
||||
git fetch origin pages
|
||||
git worktree add /tmp/pages-deploy origin/pages
|
||||
cd /tmp/pages-deploy
|
||||
|
||||
git rm -rf --ignore-unmatch .
|
||||
cp -r "$GITHUB_WORKSPACE"/site/* .
|
||||
cp "$GITHUB_WORKSPACE"/site/.[!.]* . 2>/dev/null || true
|
||||
|
||||
git add .
|
||||
if ! git diff --staged --quiet; then
|
||||
git commit -m "deploy: zensical build from ${GITHUB_SHA::7}"
|
||||
git push origin HEAD:pages
|
||||
else
|
||||
echo "No changes to deploy"
|
||||
fi
|
||||
env:
|
||||
GITHUB_WORKSPACE: ${{ github.workspace }}
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
Loading…
Reference in a new issue