Clean repository when all languages are rebuilt
When docs are built and pushed to https://github.com/MapServer/mapserver.github.io/ old HTML files are never removed.
There are several published pages which have been removed from https://github.com/MapServer/MapServer-documentation/ that are still online. For example:
- https://www.mapserver.org/mapscript/mapscript.html
- https://mapserver.org/previousversions.html
- https://mapserver.org/zh_cn/mapfile/map.html
- https://www.mapserver.org/mapfile/labelencoding.html
This pull request adds a step to delete all the files from the https://github.com/MapServer/mapserver.github.io/ repo if a pull request includes [build_translations] in the commit message. This tag is already used to trigger rebuilds of all languages.
We can only remove all files when rebuilding all languages, otherwise when building just en all the language subfolders (ar, fr etc.) would be removed.
I've tested this on my own forks - see https://github.com/geographika/MapServer-documentation/actions
Note the uk and zh_cn folders are removed completely (they haven't been build for several years):
https://github.com/MapServer/mapserver.github.io/tree/master/uk https://github.com/MapServer/mapserver.github.io/tree/master/zh_cn
The cleaned repository goes from 1.2 GB and 32,141 files to 810 MB and 28,979 files. You can compare before and after the clean-up by looking at https://github.com/MapServer/mapserver.github.io/ and https://github.com/geographika/mapserver.github.io
The only files not generated by Sphinx README.md and .nojekyll are restored after the repo is cleaned.