www/.forgejo/workflows/ci.yaml

69 lines
2.0 KiB
YAML

on:
push:
branches:
- 'master'
jobs:
synchro:
runs-on: linux_amd64
steps:
- name: Retrieve files
shell: bash
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }} www
- name: Synchronize files
shell: bash
run: |
cd www
rsync -avzlh . /home/webmaster/site-a-lec.org/articles --exclude=".[!.]*" --filter='P sidebar/*' --delete
echo $(git diff-tree --no-commit-id --name-only -r master | grep stl || find . -name "*.stl" -printf "%P\n") > /home/webmaster/site-a-lec.org/.modified
- run: echo "Job ended with status '${{ job.status }}'."
tests:
needs: synchro
runs-on: linux_amd64
steps:
- name: Syntax & validity checks
shell: bash
run: |
cd /home/webmaster/site-a-lec.org
files=$(cat .modified)
if [ -z "$files" ]; then
files=$(find . -name "*.stl" -printf %P)
fi
errors=0
for file in $files
do
echo "### Test de $file"
stl log clean
stl check $file -F | grep -e "Err" -e "erreur de" -e "Aucun fichier" && errors=$((errors+1)) # error if err is read in standard output
done
[ $errors -gt 0 ] && false
true
deploiement:
needs: tests
runs-on: linux_amd64
steps:
- name: Build html files
shell: bash
run: |
cd /home/webmaster/site-a-lec.org
files=$(cat .modified)
if [ -z "$files" ]; then
files=$(find . -name "*.stl" -printf %P)
fi
errors=0
for file in $files
do
echo "Construction de $file"
stl log clean
stl wip $file -F | grep -e "Err" -e "erreur de" -e "Aucun fichier" && errors=$((errors+1)) # error if err is read in standard output
done
[ $errors -gt 0 ] && false
true
- name: Rebuild the sidebar
shell: bash
run: |
stl sidebar load