summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-04-08 09:38:26 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2023-05-07 23:48:44 +0000
commitd399abca1acdc132ee78480fab43e18fa35736cc (patch)
treeaa1af4869a67be24740b7dd902931943669b8d67
parentd7139f1314cabf01063edde669081ab9612a809b (diff)
downloadlibevdev-d399abca1acdc132ee78480fab43e18fa35736cc.tar.gz
tools/publish-doc: enable pushing docs for specific tags
Historically, I copied the docs on the server directly after pushing latest, but (especially with meson) it's a lot easier to just build that specific tag locally and rsync it to the correct target directory. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rwxr-xr-xtools/publish-doc32
1 files changed, 29 insertions, 3 deletions
diff --git a/tools/publish-doc b/tools/publish-doc
index f83704a..525cd4b 100755
--- a/tools/publish-doc
+++ b/tools/publish-doc
@@ -2,10 +2,36 @@
set -e
-builddir=_doc_build
+tag="$1"
+case $tag in
+ -h|--help)
+ echo "Usage: $0 <tag>"
+ echo "Builds the libevdev documentation and rsyncs it to the freedesktop.org server."
+ echo ""
+ echo "Options:"
+ echo " tag ... the tag to build (default: master)"
+ exit 0
+ ;;
+ 1*)
+ # Helper so we can run it with the numerical tag only, tags
+ # are all prefixed with libevdev
+ tag="libevdev-$tag"
+ ;;
+ **)
+ ;;
+esac
+tag=${tag:-master}
+dir=$(mktemp -d --tmpdir='' libevdev-doc.XXX)
+git clone --depth 1 --branch "$tag" https://gitlab.freedesktop.org/libevdev/libevdev.git "$dir"
+pushd $dir
+builddir=_doc_build
rm -rf "$builddir"
meson setup "$builddir"
ninja -C "$builddir"
-rsync --delete -avz "$builddir/html/" freedesktop.org:/srv/www.freedesktop.org/www/software/libevdev/doc/latest
-rm -rf "$builddir"
+
+# Strip libevdev- prefix from the tag and replace master with latest, whichever applies
+htmldir=${tag/#libevdev-/}
+htmldir=${htmldir/master/latest}
+rsync --delete -avz "$builddir/html/" freedesktop.org:/srv/www.freedesktop.org/www/software/libevdev/doc/${htmldir}
+popd