1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-26 19:22:15 -05:00
xeps/tools/ci-prune-build.sh
Jonas Schäfer 0dbfaff260 Create GitLab.com CI pipeline
This pipeline features the following:

- Building of an nginx image with the XEPs as static files,
  in all formats.
- Incremental builds on the main branch and incremental builds
  for MRs based on the last main build.
- Automatic archiving of changed XEPs to the attic
- Automatic announcement to the mailing lists
2020-06-14 14:09:35 +02:00

23 lines
976 B
Bash

#!/bin/bash
set -euo pipefail
outdir="build"
# clean out tex build logs etc.
find "$outdir" -type f '(' -iname "*.aux" -o -iname "*.log" -o -iname "*.toc" -o -iname "*.tex" -o -iname "*.tex.xml" -o -iname "*.out" ')' -print0 | xargs -0r -- rm
find "$outdir" -type f '(' -iname "*.xml" -o -iname "*.html" -o -iname "*.pdf" ')' -print0 | while read -d $'\0' filename; do
if [ "$filename" = 'build/xmpp.pdf' ] || [ "$filename" = 'build/xmpp-text.pdf' ] || [ "$filename" = 'build/xeplist.xml' ]; then
continue
fi
if [[ "$filename" =~ build/refs/reference.*.xml ]]; then
base_filename="$(echo "$filename" | sed -r 's#^build/refs/reference\.XSF\.XEP-([0-9]+)\.xml#xep-\1.xml#')"
else
base_filename="$(echo "$filename" | sed -r 's#^build/(.+)\.[^.]+$#\1.xml#')"
fi
if [ ! -e "$base_filename" ]; then
printf 'deleting %q for which no source file (%q) exists\n' "$filename" "$base_filename"
rm "$filename"
fi
done