[release-notes/help-gnome-org] add gitlab pipeline




commit ddd78bd1a8c4e9ba91addd03fd762ba0158f6c89
Author: Link Dupont <link sub-pop net>
Date:   Thu Aug 19 13:27:38 2021 -0400

    add gitlab pipeline

 .gitlab-ci.yml | 19 +++++++++++++++++++
 build.sh       | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..fc66d4aa
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,19 @@
+image: fedora:34
+
+variables:
+  DEPENDENCIES:
+    findutils
+    gettext
+    git
+    gnome-doc-utils
+    unzip
+    yelp-tools
+
+pages:
+  before_script:
+    - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES
+  stage: deploy
+  script: sh -xe ./build.sh
+  artifacts:
+    paths:
+      - public
diff --git a/build.sh b/build.sh
new file mode 100644
index 00000000..265a0a85
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+REPO="https://gitlab.gnome.org/Teams/Engagement/release-notes.git";
+
+mapfile -t branches < <(git ls-remote --heads ${REPO} | awk '{print $2}' | cut -d/ -f3 | grep '^gnome-' | 
sort -V)
+
+for branch in "${branches[@]}"; do
+    VERSION="$(echo "$branch" | cut -d- -f2- | sed 's/-/./')"
+    if [ "${VERSION}" -ge "41" ]; then
+        curl -L --output "release-notes-${VERSION}.zip" 
"https://gitlab.gnome.org/Teams/Engagement/release-notes/-/jobs/artifacts/${branch}/download?job=build";
+        unzip "release-notes-${VERSION}.zip"
+        mkdir -p "public/${VERSION}/"
+        pushd help-release-notes || exit 1
+        mapfile -t langs < <(find . -maxdepth 1 -type d)
+        for LANG in "${langs[@]}"; do
+            PO_FILE="$LANG/$LANG.po"
+            if [ -e C/index.page ]; then
+                msgfmt -o "$LANG/$LANG.mo" "$PO_FILE"
+                (cd "$LANG" && itstool -m "$LANG.mo" ../C/*.page)
+            else
+                for XML_FILE in C/*.xml; do
+                    DEST="${CI_PROJECT_DIR}/public/${VERSION}/$LANG/$(basename "$XML_FILE")"
+                    BUILD=0
+                    test -e "$DEST" || BUILD=1
+                    test "$PO_FILE" -nt "$DEST" && BUILD=1
+                    test "$XML_FILE" -nt "$DEST" && BUILD=1
+                    if [ "$BUILD" = "1" ]
+                    then
+                        xml2po -e -p "$PO_FILE" "$XML_FILE" > "$DEST"
+                    fi
+                done
+            fi
+        done
+        popd || exit 1
+    fi
+done


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]