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




commit 914c0fb608561f9b56e5b96fa81eae1419d97858
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       | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 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..edc67f35
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,38 @@
+#!/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 < <(ls -1 .)
+        for LANG in "${langs[@]}"; do
+            PO_FILE="$LANG/release-notes/$LANG.po"
+            if [ -e "$PO_FILE" ]; then
+                if [ -e C/release-notes/index.page ]; then
+                    msgfmt -o "$LANG/release-notes/$LANG.mo" "$PO_FILE"
+                    (cd "$LANG" && itstool -m "release-notes/$LANG.mo" ../C/release-notes/*.page)
+                else
+                    for XML_FILE in C/release-notes/*.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
+            fi
+        done
+        popd || exit 1
+    fi
+done


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