diff --git a/.github/workflows/hidrive-next-build.yml b/.github/workflows/hidrive-next-build.yml index 15bdb72925359..467bda59ea94c 100644 --- a/.github/workflows/hidrive-next-build.yml +++ b/.github/workflows/hidrive-next-build.yml @@ -33,26 +33,142 @@ on: - ionos-dev - ionos-stable +# Ensure only one instance of this workflow runs at a time per branch +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: TARGET_PACKAGE_NAME: hidrive-next.zip REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} ARTIFACTORY_REPOSITORY_SNAPSHOT: ionos-productivity-hdnext-snapshot + # Global environment variables to avoid repeating in each step + CYPRESS_INSTALL_BINARY: 0 + PUPPETEER_SKIP_DOWNLOAD: true + NODE_OPTIONS: "--max-old-space-size=4096" permissions: contents: read jobs: - hidrive-next-build: + # Build custom NPM packages first - required by Nextcloud core and apps + build-custom-npms: runs-on: ubuntu-latest + name: Build custom NPM packages - permissions: - contents: read + steps: + - name: Checkout server + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + submodules: true + + - name: Set up node with version from package.json's engines + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version-file: "package.json" + cache: 'npm' + + - name: Install build dependencies + run: sudo apt-get update && sudo apt-get install -y build-essential make python3 zip unzip + + - name: Get custom-npms submodule hashes + id: submodule_hashes + run: | + # Get the commit hash for each custom-npm submodule + MDI_SVG_HASH=$(git rev-parse HEAD:custom-npms/nc-mdi-svg) + MDI_JS_HASH=$(git rev-parse HEAD:custom-npms/nc-mdi-js) + VUE_ICONS_HASH=$(git rev-parse HEAD:custom-npms/nc-vue-material-design-icons) + NEXTCLOUD_VUE_HASH=$(git rev-parse HEAD:custom-npms/nc-nextcloud-vue) + + echo "mdi_svg_hash=${MDI_SVG_HASH}" >> $GITHUB_OUTPUT + echo "mdi_js_hash=${MDI_JS_HASH}" >> $GITHUB_OUTPUT + echo "vue_icons_hash=${VUE_ICONS_HASH}" >> $GITHUB_OUTPUT + echo "nextcloud_vue_hash=${NEXTCLOUD_VUE_HASH}" >> $GITHUB_OUTPUT + + # Create a combined hash for all custom-npms + COMBINED_HASH=$(echo "${MDI_SVG_HASH}${MDI_JS_HASH}${VUE_ICONS_HASH}${NEXTCLOUD_VUE_HASH}" | sha256sum | cut -d' ' -f1) + echo "combined_hash=${COMBINED_HASH}" >> $GITHUB_OUTPUT + + echo "Custom-npms submodule hashes:" + echo " nc-mdi-svg: ${MDI_SVG_HASH}" + echo " nc-mdi-js: ${MDI_JS_HASH}" + echo " nc-vue-material-design-icons: ${VUE_ICONS_HASH}" + echo " nc-nextcloud-vue: ${NEXTCLOUD_VUE_HASH}" + echo " Combined: ${COMBINED_HASH}" + + - name: Cache built custom-npms (by submodule commits) + id: cache-custom-npms + uses: actions/cache@v4 + with: + path: custom-npms/ + key: ${{ runner.os }}-built-custom-npms-${{ steps.submodule_hashes.outputs.combined_hash }} + restore-keys: | + ${{ runner.os }}-built-custom-npms- + + - name: Cache custom-npms node_modules (if building) + if: steps.cache-custom-npms.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: custom-npms/*/node_modules + key: ${{ runner.os }}-custom-npms-modules-${{ steps.submodule_hashes.outputs.combined_hash }} + restore-keys: | + ${{ runner.os }}-custom-npms-modules- + + - name: Build custom MDI SVG + if: steps.cache-custom-npms.outputs.cache-hit != 'true' + run: | + cd custom-npms/nc-mdi-svg + FONTAWESOME_PACKAGE_TOKEN=${{ secrets.FONTAWESOME_PACKAGE_TOKEN }} npm ci + npm run build + echo "✓ nc-mdi-svg built" + + - name: Build custom MDI JS + if: steps.cache-custom-npms.outputs.cache-hit != 'true' + run: | + cd custom-npms/nc-mdi-js + npm ci + npm run build + echo "✓ nc-mdi-js built" + + - name: Build custom Vue icons package + if: steps.cache-custom-npms.outputs.cache-hit != 'true' + run: | + cd custom-npms/nc-vue-material-design-icons + npm ci + npm run build + echo "✓ nc-vue-material-design-icons built" + + - name: Build custom Nextcloud Vue + if: steps.cache-custom-npms.outputs.cache-hit != 'true' + run: | + cd custom-npms/nc-nextcloud-vue + npm ci + npm run build + echo "✓ nc-nextcloud-vue built" + + - name: Report cache status + run: | + if [ "${{ steps.cache-custom-npms.outputs.cache-hit }}" == "true" ]; then + echo "🎉 Custom-npms cache hit! Skipped building all packages." + echo "Using cached packages from hash: ${{ steps.submodule_hashes.outputs.combined_hash }}" + else + echo "🔨 Cache miss. Built all custom-npms packages." + echo "New cache key: ${{ steps.submodule_hashes.outputs.combined_hash }}" + fi + + outputs: + custom_npms_cache_key: ${{ steps.submodule_hashes.outputs.combined_hash }} + + # Build Nextcloud core after custom-npms are ready + build-nextcloud-core: + runs-on: ubuntu-latest + needs: build-custom-npms + name: Build Nextcloud core outputs: NC_VERSION: ${{ steps.get_nc_version.outputs.NC_VERSION }} - name: hidrive-next-build steps: - name: Checkout server uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 @@ -63,12 +179,7 @@ jobs: uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version-file: "package.json" - - - name: Install Dependencies - run: sudo apt-get update && sudo apt-get install -y make zip unzip - - - name: Print dependencies versions - run: make --version && node --version && npm --version + cache: 'npm' - name: Setup PHP with PECL extension uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 #v2.31.1 @@ -76,66 +187,555 @@ jobs: tools: composer:v2 extensions: gd, zip, curl, xml, xmlrpc, mbstring, sqlite, xdebug, pgsql, intl, imagick, gmp, apcu, bcmath, redis, soap, imap, opcache env: - runner: self-hosted + runner: ubuntu-latest - - name: Print PHP install - run: php -i && php -m + - name: Install build dependencies + run: sudo apt-get update && sudo apt-get install -y make zip unzip - - name: Build Nextcloud - run: make -f IONOS/Makefile build_nextcloud FONTAWESOME_PACKAGE_TOKEN=${{ secrets.FONTAWESOME_PACKAGE_TOKEN }} + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: ~/.composer/cache + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- - - name: Install dependencies & build simplesettings app - env: - CYPRESS_INSTALL_BINARY: 0 - PUPPETEER_SKIP_DOWNLOAD: true - run: make -f IONOS/Makefile build_dep_simplesettings_app + - name: Restore built custom-npms + uses: actions/cache/restore@v4 + with: + path: custom-npms/ + key: ${{ runner.os }}-built-custom-npms-${{ needs.build-custom-npms.outputs.custom_npms_cache_key }} + fail-on-cache-miss: true - - name: Install dependencies & build viewer app - env: - CYPRESS_INSTALL_BINARY: 0 - PUPPETEER_SKIP_DOWNLOAD: true - run: make -f IONOS/Makefile build_dep_viewer_app + - name: Build Nextcloud core (without custom-npms - already built) + run: | + composer install --no-dev -o + npm ci + NODE_OPTIONS="--max-old-space-size=4096" npm run build - - name: Install dependencies & build richdocuments app - run: make -f IONOS/Makefile build_richdocuments_app + - name: Get NC version and create version.json + id: get_nc_version + continue-on-error: false + run: | + NC_VERSION=$(php -r 'include("version.php");echo implode(".", $OC_Version);') + echo "NC_VERSION: $NC_VERSION" - - name: Install dependencies & build user_oidc app - env: - CYPRESS_INSTALL_BINARY: 0 - PUPPETEER_SKIP_DOWNLOAD: true + if [ -z "$NC_VERSION" ]; then + echo "NC_VERSION is empty" + exit 1 + fi + + echo "NC_VERSION=$NC_VERSION" >> $GITHUB_OUTPUT + + # Create version.json in one go + buildDate=$(date +%s) + buildRef=$(git rev-parse --short HEAD) + jq -n --arg buildDate "$buildDate" --arg buildRef "$buildRef" --arg ncVersion "$NC_VERSION" \ + '{buildDate: $buildDate, buildRef: $buildRef, ncVersion: $ncVersion}' > version.json + echo "version.json created:" + jq . version.json + + - name: Cache built Nextcloud core + uses: actions/cache/save@v4 + with: + path: | + dist/ + core/ + lib/ + resources/ + version.json + composer.lock + key: ${{ runner.os }}-nextcloud-core-${{ github.sha }} + + # Dedicated job for each app + build-simplesettings-app: + runs-on: ubuntu-latest + needs: build-custom-npms + name: Build simplesettings app + + steps: + - name: Checkout server + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + submodules: true + + - name: Set up node + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version-file: "package.json" + + - name: Install build dependencies (if needed) + run: sudo apt-get update && sudo apt-get install -y build-essential make python3 zip unzip + + - name: Get simplesettings submodule hash + id: submodule_hash + run: | + SIMPLESETTINGS_HASH=$(git rev-parse HEAD:apps-custom/simplesettings) + echo "hash=${SIMPLESETTINGS_HASH}" >> $GITHUB_OUTPUT + echo "simplesettings submodule hash: ${SIMPLESETTINGS_HASH}" + + - name: Cache built simplesettings app (by submodule commit) + id: cache-app + uses: actions/cache@v4 + with: + path: apps-custom/simplesettings/ + key: ${{ runner.os }}-built-simplesettings-${{ steps.submodule_hash.outputs.hash }} + restore-keys: | + ${{ runner.os }}-built-simplesettings- + + - name: Cache app node_modules (if building) + if: steps.cache-app.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: apps-custom/simplesettings/node_modules + key: ${{ runner.os }}-simplesettings-modules-${{ steps.submodule_hash.outputs.hash }} + restore-keys: | + ${{ runner.os }}-simplesettings-modules- + + - name: Restore built custom-npms + if: steps.cache-app.outputs.cache-hit != 'true' + uses: actions/cache/restore@v4 + with: + path: custom-npms/ + key: ${{ runner.os }}-built-custom-npms-${{ needs.build-custom-npms.outputs.custom_npms_cache_key }} + fail-on-cache-miss: true + + - name: Build simplesettings app + if: steps.cache-app.outputs.cache-hit != 'true' + run: | + make -f IONOS/Makefile build_dep_simplesettings_app + echo "✓ simplesettings app built" + + - name: Report cache status + run: | + if [ "${{ steps.cache-app.outputs.cache-hit }}" == "true" ]; then + echo "🎉 Simplesettings app cache hit! Skipped building." + else + echo "🔨 Cache miss. Built simplesettings app." + fi + + outputs: + cache_key: ${{ steps.submodule_hash.outputs.hash }} + + build-viewer-app: + runs-on: ubuntu-latest + needs: build-custom-npms + name: Build viewer app + + steps: + - name: Checkout server + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + submodules: true + + - name: Set up node + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version-file: "package.json" + + - name: Setup PHP + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 #v2.31.1 + with: + tools: composer:v2 + + - name: Install build dependencies (if needed) + run: sudo apt-get update && sudo apt-get install -y build-essential make python3 zip unzip + + - name: Get viewer submodule hash + id: submodule_hash + run: | + VIEWER_HASH=$(git rev-parse HEAD:apps-external/viewer) + echo "hash=${VIEWER_HASH}" >> $GITHUB_OUTPUT + echo "viewer submodule hash: ${VIEWER_HASH}" + + - name: Cache built viewer app (by submodule commit) + id: cache-app + uses: actions/cache@v4 + with: + path: apps-external/viewer/ + key: ${{ runner.os }}-built-viewer-${{ steps.submodule_hash.outputs.hash }} + restore-keys: | + ${{ runner.os }}-built-viewer- + + - name: Cache app dependencies (if building) + if: steps.cache-app.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: | + apps-external/viewer/node_modules + ~/.composer/cache + key: ${{ runner.os }}-viewer-deps-${{ steps.submodule_hash.outputs.hash }} + restore-keys: | + ${{ runner.os }}-viewer-deps- + + - name: Restore built custom-npms + if: steps.cache-app.outputs.cache-hit != 'true' + uses: actions/cache/restore@v4 + with: + path: custom-npms/ + key: ${{ runner.os }}-built-custom-npms-${{ needs.build-custom-npms.outputs.custom_npms_cache_key }} + fail-on-cache-miss: true + + - name: Build viewer app + if: steps.cache-app.outputs.cache-hit != 'true' + run: | + make -f IONOS/Makefile build_dep_viewer_app + echo "✓ viewer app built" + + - name: Report cache status + run: | + if [ "${{ steps.cache-app.outputs.cache-hit }}" == "true" ]; then + echo "🎉 Viewer app cache hit! Skipped building." + else + echo "🔨 Cache miss. Built viewer app." + fi + + outputs: + cache_key: ${{ steps.submodule_hash.outputs.hash }} + + build-richdocuments-app: + runs-on: ubuntu-latest + needs: build-custom-npms + name: Build richdocuments app + + steps: + - name: Checkout server + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + submodules: true + + - name: Set up node + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version-file: "package.json" + + - name: Setup PHP + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 #v2.31.1 + with: + tools: composer:v2 + + - name: Install build dependencies (if needed) + run: sudo apt-get update && sudo apt-get install -y build-essential make python3 zip unzip + + - name: Get richdocuments submodule hash + id: submodule_hash + run: | + RICHDOCUMENTS_HASH=$(git rev-parse HEAD:apps-external/richdocuments) + echo "hash=${RICHDOCUMENTS_HASH}" >> $GITHUB_OUTPUT + echo "richdocuments submodule hash: ${RICHDOCUMENTS_HASH}" + + - name: Cache built richdocuments app (by submodule commit) + id: cache-app + uses: actions/cache@v4 + with: + path: apps-external/richdocuments/ + key: ${{ runner.os }}-built-richdocuments-${{ steps.submodule_hash.outputs.hash }} + restore-keys: | + ${{ runner.os }}-built-richdocuments- + + - name: Cache app dependencies (if building) + if: steps.cache-app.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: | + apps-external/richdocuments/node_modules + ~/.composer/cache + key: ${{ runner.os }}-richdocuments-deps-${{ steps.submodule_hash.outputs.hash }} + restore-keys: | + ${{ runner.os }}-richdocuments-deps- + + - name: Build richdocuments app + if: steps.cache-app.outputs.cache-hit != 'true' + run: | + make -f IONOS/Makefile build_richdocuments_app + echo "✓ richdocuments app built" + + - name: Report cache status + run: | + if [ "${{ steps.cache-app.outputs.cache-hit }}" == "true" ]; then + echo "🎉 Richdocuments app cache hit! Skipped building." + else + echo "🔨 Cache miss. Built richdocuments app." + fi + + outputs: + cache_key: ${{ steps.submodule_hash.outputs.hash }} + + build-user-oidc-app: + runs-on: ubuntu-latest + needs: build-custom-npms + name: Build user_oidc app + + steps: + - name: Checkout server + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + submodules: true + + - name: Set up node + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version-file: "package.json" + + - name: Setup PHP + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 #v2.31.1 + with: + tools: composer:v2 + + - name: Install build dependencies (if needed) + run: sudo apt-get update && sudo apt-get install -y build-essential make python3 zip unzip + + - name: Cache app dependencies + uses: actions/cache@v4 + with: + path: | + apps-external/user_oidc/node_modules + ~/.composer/cache + key: ${{ runner.os }}-user-oidc-${{ hashFiles('apps-external/user_oidc/package-lock.json', 'apps-external/user_oidc/composer.lock') }} + + - name: Build user_oidc app run: make -f IONOS/Makefile build_dep_user_oidc_app - - name: Install dependencies for external apps nc_ionos_processes + - name: Cache built app + uses: actions/cache/save@v4 + with: + path: apps-external/user_oidc/ + key: ${{ runner.os }}-built-user-oidc-${{ github.sha }} + + build-nc-ionos-processes-app: + runs-on: ubuntu-latest + needs: build-custom-npms + name: Build nc_ionos_processes app + + steps: + - name: Checkout server + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + submodules: true + + - name: Setup PHP + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 #v2.31.1 + with: + tools: composer:v2 + + - name: Install basic dependencies + run: sudo apt-get update && sudo apt-get install -y make zip unzip + + - name: Cache composer dependencies + uses: actions/cache@v4 + with: + path: ~/.composer/cache + key: ${{ runner.os }}-composer-${{ hashFiles('apps-custom/nc_ionos_processes/composer.lock') }} + + - name: Build nc_ionos_processes app run: make -f IONOS/Makefile build_dep_nc_ionos_processes_app - - name: Build Custom CSS + - name: Cache built app + uses: actions/cache/save@v4 + with: + path: apps-custom/nc_ionos_processes/ + key: ${{ runner.os }}-built-nc-ionos-processes-${{ github.sha }} + + build-theming-app: + runs-on: ubuntu-latest + needs: build-custom-npms + name: Build theming app + + steps: + - name: Checkout server + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + submodules: true + + - name: Install basic dependencies + run: sudo apt-get update && sudo apt-get install -y make zip unzip + + - name: Build theming app run: make -f IONOS/Makefile build_dep_theming_app - - name: Install dependencies & build IONOS theme custom elements - env: - CYPRESS_INSTALL_BINARY: 0 - PUPPETEER_SKIP_DOWNLOAD: true - run: make -f IONOS/Makefile build_dep_ionos_theme + - name: Cache built app + uses: actions/cache/save@v4 + with: + path: apps-custom/nc_theming/ + key: ${{ runner.os }}-built-theming-${{ github.sha }} - - name: Add config partials - run: make -f IONOS/Makefile add_config_partials + build-ionos-theme: + runs-on: ubuntu-latest + needs: build-custom-npms + name: Build IONOS theme - - name: Zip dependencies - run: make -f IONOS/Makefile zip_dependencies TARGET_PACKAGE_NAME=${{ env.TARGET_PACKAGE_NAME }} + steps: + - name: Checkout server + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + submodules: true - - name: Get NC version - id: get_nc_version - continue-on-error: false + - name: Set up node + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version-file: "package.json" + + - name: Install build dependencies (if needed) + run: sudo apt-get update && sudo apt-get install -y build-essential make python3 + + - name: Get IONOS theme submodule hash + id: submodule_hash run: | - NC_VERSION=$(jq -r '.ncVersion' version.json) - echo "NC_VERSION: $NC_VERSION" + IONOS_THEME_HASH=$(git rev-parse HEAD:themes/nc-ionos-theme) + echo "hash=${IONOS_THEME_HASH}" >> $GITHUB_OUTPUT + echo "IONOS theme submodule hash: ${IONOS_THEME_HASH}" - if [ -z "$NC_VERSION" ]; then - echo "NC_VERSION is empty" - exit 1 + - name: Cache built IONOS theme (by submodule commit) + id: cache-theme + uses: actions/cache@v4 + with: + path: themes/nc-ionos-theme/ + key: ${{ runner.os }}-built-ionos-theme-${{ steps.submodule_hash.outputs.hash }} + restore-keys: | + ${{ runner.os }}-built-ionos-theme- + + - name: Cache theme node_modules (if building) + if: steps.cache-theme.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: themes/nc-ionos-theme/IONOS/node_modules + key: ${{ runner.os }}-ionos-theme-modules-${{ steps.submodule_hash.outputs.hash }} + restore-keys: | + ${{ runner.os }}-ionos-theme-modules- + + - name: Build IONOS theme + if: steps.cache-theme.outputs.cache-hit != 'true' + run: | + make -f IONOS/Makefile build_dep_ionos_theme + echo "✓ IONOS theme built" + + - name: Report cache status + run: | + if [ "${{ steps.cache-theme.outputs.cache-hit }}" == "true" ]; then + echo "🎉 IONOS theme cache hit! Skipped building." + else + echo "🔨 Cache miss. Built IONOS theme." fi - echo "NC_VERSION=$NC_VERSION" >> $GITHUB_OUTPUT + outputs: + cache_key: ${{ steps.submodule_hash.outputs.hash }} + + # Final assembly job that combines everything + hidrive-next-build: + runs-on: ubuntu-latest + needs: + - build-custom-npms + - build-nextcloud-core + - build-simplesettings-app + - build-viewer-app + - build-richdocuments-app + - build-user-oidc-app + - build-nc-ionos-processes-app + - build-theming-app + - build-ionos-theme + + permissions: + contents: read + + outputs: + NC_VERSION: ${{ needs.build-nextcloud-core.outputs.NC_VERSION }} + + name: Package HiDrive Next + steps: + - name: Checkout server + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + submodules: true + + - name: Install Dependencies + run: sudo apt-get update && sudo apt-get install -y make zip unzip + + - name: Setup PHP with PECL extension + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 #v2.31.1 + with: + tools: composer:v2 + extensions: gd, zip, curl, xml, xmlrpc, mbstring, sqlite, xdebug, pgsql, intl, imagick, gmp, apcu, bcmath, redis, soap, imap, opcache + env: + runner: ubuntu-latest + + - name: Restore built Nextcloud core + uses: actions/cache/restore@v4 + with: + path: | + dist/ + core/ + lib/ + resources/ + version.json + composer.lock + key: ${{ runner.os }}-nextcloud-core-${{ github.sha }} + fail-on-cache-miss: true + + - name: Restore built custom-npms + uses: actions/cache/restore@v4 + with: + path: custom-npms/ + key: ${{ runner.os }}-built-custom-npms-${{ needs.build-custom-npms.outputs.custom_npms_cache_key }} + fail-on-cache-miss: true + + - name: Restore all built apps and themes + run: | + echo "Restoring all built apps and themes..." + + - name: Restore simplesettings app + uses: actions/cache/restore@v4 + with: + path: apps-custom/simplesettings/ + key: ${{ runner.os }}-built-simplesettings-${{ needs.build-simplesettings-app.outputs.cache_key }} + fail-on-cache-miss: true + + - name: Restore viewer app + uses: actions/cache/restore@v4 + with: + path: apps-external/viewer/ + key: ${{ runner.os }}-built-viewer-${{ needs.build-viewer-app.outputs.cache_key }} + fail-on-cache-miss: true + + - name: Restore richdocuments app + uses: actions/cache/restore@v4 + with: + path: apps-external/richdocuments/ + key: ${{ runner.os }}-built-richdocuments-${{ needs.build-richdocuments-app.outputs.cache_key }} + fail-on-cache-miss: true + + - name: Restore user_oidc app + uses: actions/cache/restore@v4 + with: + path: apps-external/user_oidc/ + key: ${{ runner.os }}-built-user-oidc-${{ github.sha }} + fail-on-cache-miss: true + + - name: Restore nc_ionos_processes app + uses: actions/cache/restore@v4 + with: + path: apps-custom/nc_ionos_processes/ + key: ${{ runner.os }}-built-nc-ionos-processes-${{ github.sha }} + fail-on-cache-miss: true + + - name: Restore theming app + uses: actions/cache/restore@v4 + with: + path: apps-custom/nc_theming/ + key: ${{ runner.os }}-built-theming-${{ github.sha }} + fail-on-cache-miss: true + + - name: Restore IONOS theme + uses: actions/cache/restore@v4 + with: + path: themes/nc-ionos-theme/ + key: ${{ runner.os }}-built-ionos-theme-${{ needs.build-ionos-theme.outputs.cache_key }} + fail-on-cache-miss: true + + - name: Add config partials + run: make -f IONOS/Makefile add_config_partials + + - name: Zip dependencies + run: make -f IONOS/Makefile zip_dependencies TARGET_PACKAGE_NAME=${{ env.TARGET_PACKAGE_NAME }} - name: Upload artifact result for job hidrive-next-build uses: actions/upload-artifact@v4 @@ -152,7 +752,7 @@ jobs: exit 1 # make it red to grab attention upload-to-artifactory: - runs-on: self-hosted + runs-on: ubuntu-latest # Upload the artifact to the Artifactory repository on PR *OR* on "ionos-dev|ionos-stable" branch push defined in the on:push:branches if: github.event_name == 'pull_request' || github.ref_name == 'ionos-dev' || github.ref_name == 'ionos-stable' @@ -178,11 +778,6 @@ jobs: JF_USER: ${{ secrets.JF_ARTIFACTORY_USER }} JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }} - - name: Ping the JF server - run: | - # Ping the server - jf rt ping - - name: Upload build to artifactory id: artifactory_upload run: | @@ -221,7 +816,7 @@ jobs: git --no-pager diff exit 1 # make it red to grab attention - hidirve-next-artifact-to-ghcr_io: + hidrive-next-artifact-to-ghcr_io: runs-on: ubuntu-latest permissions: @@ -250,9 +845,12 @@ jobs: with: images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Create Dockerfile run: | - cat >Dockerfile << EOF + cat >Dockerfile << 'EOF' FROM busybox as builder COPY ./${{ env.TARGET_PACKAGE_NAME }} / WORKDIR /builder @@ -271,6 +869,8 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max - name: Show changes on failure if: failure() @@ -278,7 +878,7 @@ jobs: exit 1 # make it red to grab attention - trigger-remote-dev-worflow: + trigger-remote-dev-workflow: runs-on: self-hosted name: Trigger remote workflow @@ -288,22 +888,19 @@ jobs: steps: - name: Trigger remote workflow run: | - # Enable command echo - set -x - # The 'ionos-dev' branch will trigger remote "dev" branch workflow GITLAB_BRANCH="dev" - # set ARTIFACTORY_STAGE_PREFIX=stable on ionos-stable branch + # set GITLAB_BRANCH=stable on ionos-stable branch if [ ${{ github.ref_name }} == "ionos-stable" ]; then GITLAB_BRANCH="stable" fi + echo "Triggering remote workflow on branch: ${GITLAB_BRANCH}" + # Call webhook curl \ --silent \ - --insecure \ - --request POST \ --fail-with-body \ -o response.json \ --form token=${{ secrets.GITLAB_TOKEN }} \ @@ -312,19 +909,20 @@ jobs: --form "variables[ARTIFACTORY_LAST_BUILD_PATH]=${{ needs.upload-to-artifactory.outputs.ARTIFACTORY_LAST_BUILD_PATH }}" \ --form "variables[NC_VERSION]=${{ needs.hidrive-next-build.outputs.NC_VERSION }}" \ --form "variables[BUILD_ID]=${{ github.run_id }}" \ - "${{ secrets.GITLAB_TRIGGER_URL }}" || ( RETCODE="$?"; jq . response.json; exit "$RETCODE" ) - - # Disable command echo - set +x - - # Print and parse json - # jq . response.json - echo "json<> $GITHUB_OUTPUT - cat response.json >> $GITHUB_OUTPUT - echo "END" >> $GITHUB_OUTPUT - echo "web_url<> $GITHUB_OUTPUT - cat response.json | jq --raw-output '.web_url' >> $GITHUB_OUTPUT - echo "END" >> $GITHUB_OUTPUT + "${{ secrets.GITLAB_TRIGGER_URL }}" || { + RETCODE="$?" + echo "Webhook call failed with code: $RETCODE" + if [ -f response.json ]; then + echo "Response:" + jq . response.json + fi + exit "$RETCODE" + } + + echo "Remote workflow triggered successfully" + if [ -f response.json ]; then + jq . response.json + fi - name: Show changes on failure if: failure()