forked from Controls/gitea-pages
Build and Deploy Documentation / build-and-deploy (push) Successful in 4s
Unfortunately the build workflow uses an ages old zensical version which does not return an error status if redering fails. Instead now generate an error status if a line starting with "Error:" is found in the zensical message output.
46 lines
1.6 KiB
YAML
46 lines
1.6 KiB
YAML
name: Build and Deploy Documentation
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: gitea.psi.ch/images/alpine-zensical
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build page
|
|
run: |
|
|
sed -i 's|repo_url[[:space:]]*=[[:space:]]*".*"|repo_url = "${{ github.server_url }}/${{ github.repository }}"|' zensical.toml
|
|
echo "Zensical version: `/opt/python-env/bin/zensical --version`"
|
|
# As long as we use ages old Zensical version 0.0.11,
|
|
# error status return does not work. Let's do our own.
|
|
#/opt/python-env/bin/zensical build
|
|
! /opt/python-env/bin/zensical build 2>&1 | tee /dev/stderr | grep -q '^Error:'
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name "Gitea Actions"
|
|
git config --global user.email "actions@gitea.local"
|
|
|
|
- name: Push to gitea-pages branch
|
|
run: |
|
|
git checkout --orphan gitea-pages
|
|
git reset --hard
|
|
mv site/* .
|
|
git add .
|
|
git commit -m "Update site - $(date)"
|
|
REPO_URL=$(echo "${{ github.server_url }}/${{ github.repository }}.git" | sed 's|https://||')
|
|
git push -f https://${{ secrets.GITHUB_TOKEN }}@$REPO_URL gitea-pages
|
|
|
|
NAMESPACE=$(echo "${{ github.repository }}" | sed 's|/.*||')
|
|
REPO=$(echo "${{ github.repository }}" | sed -e 's|^[^/]*/|/|' -e 's|/gitea-pages||')
|
|
echo Your page is now at https://${NAMESPACE}.pages.psi.ch${REPO}
|
|
|