From ff477556154bc45299e0d98b9320b65e03507ad8 Mon Sep 17 00:00:00 2001 From: fithwum Date: Sat, 5 Jul 2025 08:37:22 -0700 Subject: [PATCH] test --- .gitea/workflows/base-build.yml | 80 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/.gitea/workflows/base-build.yml b/.gitea/workflows/base-build.yml index fb74571..e2bcc87 100644 --- a/.gitea/workflows/base-build.yml +++ b/.gitea/workflows/base-build.yml @@ -1,71 +1,74 @@ -name: Build RootFS Archives and Push Docker Images +name: Build and Upload Multiple Debian RootFS Versions on: push: branches: - - main + - master # paths: - # - 'base-image-script/**' + # - 'base-image-script/**' schedule: - - cron: '0 12 * * 0' # Sunday noon UTC + - cron: '0 12 * * 0' # Sunday at noon UTC jobs: - build-rootfs-archives: + build-debian-variants: runs-on: docker-build - strategy: - matrix: - version: [buster, bullseye, bookworm, docker-build] steps: - - name: Checkout code + - name: Checkout source uses: actions/checkout@v3 - - name: Build Docker image for ${{ matrix.version }} + - name: Build all Debian rootfs versions sequentially run: | - docker build --build-arg VERSION=${{ matrix.version }} -t fithwum/debian-${{ matrix.version }}-base . + versions=(buster bullseye bookworm docker-build) + registry="gitea.fithwum.tech" + org="fithwum" + repo="debian-base" - - name: Run rootfs builder (pt1 script) - run: | - docker run --rm --privileged \ - -v "$(pwd)":/output \ - fithwum/debian-${{ matrix.version }}-base \ - bash base-image-script/debian-${{ matrix.version }}_pt1.sh + for version in "${versions[@]}"; do + echo "[INFO] Building Debian $version rootfs..." + + image_tag="${registry}/${org}/${repo}:${version}" + + # Build Docker image with full tag + docker build --build-arg VERSION=$version -t "$image_tag" . + + # Run the pt1.sh script inside the container to build rootfs + docker run --rm --privileged \ + -v "$(pwd)":/output \ + "$image_tag" \ + bash base-image-script/debian-${version}_pt1.sh + done - name: List output archive run: | echo "[INFO] Looking for tarballs in workspace..." find . -name '*.tar.bz2' -ls - - name: Push tarball archives to repo + - name: Clone and push to Gitea repo env: - GIT_USER: ${{ secrets.GIT_USERNAME }} + GIT_USERNAME: ${{ secrets.GIT_USERNAME }} GIT_EMAIL: ${{ secrets.GIT_EMAIL }} REPO_URL: ${{ secrets.REPO_URL }} run: | - git config --global user.name "$GIT_USER" + git config --global user.name "$GIT_USERNAME" git config --global user.email "$GIT_EMAIL" git clone "$REPO_URL" upload-repo - # Clean old archives - mkdir -p upload-repo/${{ matrix.version }} - find upload-repo/${{ matrix.version }} -name '*.tar.bz2' -type f -delete + # Remove all old tarballs from upload-repo to avoid clutter + find upload-repo -name '*.tar.bz2' -type f -delete - # Find and copy archives - found=$(find . -name '*.tar.bz2') - if [ -n "$found" ]; then - for filepath in $found; do - version_dir=$(dirname "$filepath") - mkdir -p upload-repo/"$version_dir" - cp "$filepath" upload-repo/"$version_dir"/ - done - - # Debug list to verify files copied - ls -lR upload-repo + # Copy all new tarballs from workspace into upload-repo preserving folder structure + find . -name '*.tar.bz2' -exec bash -c ' + for filepath; do + dir=$(dirname "$filepath") + mkdir -p "upload-repo/$dir" + cp "$filepath" "upload-repo/$dir/" + done + ' bash {} + cd upload-repo - - git add **/*.tar.bz2 + git add '**/*.tar.bz2' if git diff --cached --quiet; then echo "[INFO] No changes to commit." @@ -74,11 +77,6 @@ jobs: git push fi - else - echo "[WARNING] No .tar.bz2 archive found in workspace!" - exit 1 - fi - build-and-push-docker-images: runs-on: docker-build needs: build-rootfs-archives