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




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

    add gitlab pipeline

 .gitlab-ci.yml | 17 +++++++++++++++++
 build.sh       | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..46bc36ef
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,17 @@
+image: fedora:34
+
+variables:
+  DEPENDENCIES:
+    findutils
+    git
+    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..9319ce07
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,34 @@
+#!/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/-/./')"
+    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
+done


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