[TikiWiki-commits] [Git][tikiwiki/tiki][master] [REF] Centralize package build logic

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a7d1001b9459_381aec1c31de@gitlab-sidekiq-low-urgency-cpu-bound-v2-68f8b9558d-kqcnj.mail>

ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
e71a77ff by ushindi bienvenu at 2026-08-13T00:15:53+00:00
[REF] Centralize package build logic
---
* [REF] Centralize package build logic

* Make frontend build script executable

* [REF] Centralize package build logic

See merge request tikiwiki/tiki!10842

- - - - -


3 changed files:

- .gitlab-ci.yml
- + src/ci/build_frontend.sh
- + src/ci/build_package.sh


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -89,7 +89,7 @@ node_modules:
   stage: build
   needs: []
   script:
-    - npm ci --prefer-offline
+    - src/ci/build_frontend.sh install
   extends: .node_dependencies_cache
   cache:
     policy: pull-push
@@ -109,9 +109,7 @@ node_build:
   image:
     name: ${DEPENDENCY_PROXY_PREFIX}${NODE_IMAGE}
   script:
-    - free -h
-    - NODE_OPTIONS="--max-old-space-size=4096" npm run build
-    - free -h
+    - src/ci/build_frontend.sh build
   artifacts:
     expire_in: 2 days
     paths:
@@ -685,25 +683,6 @@ unit-tests-icon-generator:
 # Package this Tiki build
 #
 
-.tiki-package-prepare-script: &tiki-package-prepare-script |
-  echo "=> Removing Composer dev dependencies ..."
-  composer -V | grep "version 2" || composer self-update --2
-  composer --ansi install -d vendor_bundled --no-dev --optimize-autoloader --no-progress --prefer-dist -n
-  php console.php dev:buildwsconfs --generate
-  echo "=> Cleanup ..."
-  rm -fr temp && git checkout temp
-  rm -fr bin
-  echo "=> Optimize language files ..."
-  find lang/ -name language.php -exec php doc/devtools/stripcomments.php {} \;
-  echo "=> Fix permissions ..."
-  find . -type f -exec chmod 0664 {} \;
-  chmod 0775 setup.sh
-  find . -type d -exec chmod 0755 {} \;
-
-.tiki-package-tar-script: &tiki-package-tar-script |
-  echo "=> Pack tiki ..."
-  tar --exclude *.DS_Store --exclude tests --exclude doc/devtools --exclude .git --exclude .gitignore --exclude .composercache -pczf tiki-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_REF_SLUG}.tar.gz *
-
 .tiki-package-changelog-script: &tiki-package-changelog-script |
   echo "=> Generate changelog ..."
   TARGET_BRANCH="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-$CI_DEFAULT_BRANCH}"
@@ -736,8 +715,7 @@ tiki-package-shallow:
       when: always
     - when: never
   script:
-    - *tiki-package-prepare-script
-    - *tiki-package-tar-script
+    - PACKAGE_FILENAME="tiki-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_REF_SLUG}.tar.gz" src/ci/build_package.sh
 
 # 2. DEEP PACKAGING: Slower because it needs to fetch all tags and apply only on merge requests to the master branch.
 tiki-package-deep:
@@ -751,9 +729,8 @@ tiki-package-deep:
       when: always
     - when: never
   script:
-    - *tiki-package-prepare-script
     - *tiki-package-changelog-script
-    - *tiki-package-tar-script
+    - PACKAGE_FILENAME="tiki-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_REF_SLUG}.tar.gz" src/ci/build_package.sh
   artifacts:
     paths:
       - tiki-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_REF_SLUG}.tar.gz


=====================================
src/ci/build_frontend.sh
=====================================
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
+#
+# All Rights Reserved. See copyright.txt for details and a complete list of authors.
+# Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+
+set -euo pipefail
+
+case "${1:-}" in
+    install)
+        npm ci --prefer-offline
+        ;;
+
+    build)
+        free -h
+        NODE_OPTIONS="--max-old-space-size=4096" npm run build
+        free -h
+        ;;
+
+    *)
+        echo "Usage: $0 {install|build}"
+        exit 1
+        ;;
+esac


=====================================
src/ci/build_package.sh
=====================================
@@ -0,0 +1,85 @@
+#!/usr/bin/env bash
+
+# (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
+#
+# All Rights Reserved. See copyright.txt for details and a complete list of authors.
+# Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+
+set -euo pipefail
+
+PACKAGE_FILENAME="${PACKAGE_FILENAME:-tiki-package.tar.gz}"
+
+PACKAGE_EXCLUDES=(
+    "tests"
+    "doc/devtools"
+    ".git"
+    ".gitignore"
+    ".composercache"
+    ".husky"
+    ".gitpod"
+    ".editorconfig"
+    ".gitattributes"
+    ".gitlab-ci.yml"
+    ".gitlab-ci-local-env"
+    ".gitlab-ci-local-variables.yml"
+    ".gitpod.yml"
+    ".phplint.yml"
+    ".prettierrc"
+    ".vimrc"
+    "auto-imports.d.ts"
+    "components.d.ts"
+    "check_composer_exists.php"
+    "eslint.config.js"
+    "commitlint.config.cjs"
+)
+
+echo "=> Removing Composer dev dependencies..."
+
+composer -V | grep "version 2" || composer self-update --2
+
+composer --ansi install \
+    -d vendor_bundled \
+    --no-dev \
+    --optimize-autoloader \
+    --no-progress \
+    --prefer-dist \
+    -n
+
+php console.php dev:buildwsconfs --generate
+
+echo "=> Cleanup..."
+
+rm -rf temp
+git checkout -- temp
+
+rm -rf bin
+rm -rf node_modules
+
+echo "=> Optimize language files..."
+
+find lang/ \
+    -name language.php \
+    -exec php doc/devtools/stripcomments.php {} \;
+
+find lang/ -name 'language.php.old' -delete
+
+echo "=> Permissions..."
+
+find . -type f -exec chmod 0664 {} \;
+chmod 0775 setup.sh
+find . -type d -exec chmod 0755 {} \;
+
+echo "=> Creating package..."
+
+TAR_EXCLUDES=()
+
+for path in "${PACKAGE_EXCLUDES[@]}"; do
+    TAR_EXCLUDES+=("--exclude=${path}")
+done
+
+tar \
+    "${TAR_EXCLUDES[@]}" \
+    -pczf "$PACKAGE_FILENAME" \
+    *
+
+echo "=> Package created: $PACKAGE_FILENAME"



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/e71a77ff3cec2e09a2589ebb2a21d214261d6863

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/e71a77ff3cec2e09a2589ebb2a21d214261d6863
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.