test
This commit is contained in:
@@ -1,71 +1,74 @@
|
|||||||
name: Build RootFS Archives and Push Docker Images
|
name: Build and Upload Multiple Debian RootFS Versions
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- master
|
||||||
# paths:
|
# paths:
|
||||||
# - 'base-image-script/**'
|
# - 'base-image-script/**'
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 12 * * 0' # Sunday noon UTC
|
- cron: '0 12 * * 0' # Sunday at noon UTC
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-rootfs-archives:
|
build-debian-variants:
|
||||||
runs-on: docker-build
|
runs-on: docker-build
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
version: [buster, bullseye, bookworm, docker-build]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout source
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Build Docker image for ${{ matrix.version }}
|
- name: Build all Debian rootfs versions sequentially
|
||||||
run: |
|
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)
|
for version in "${versions[@]}"; do
|
||||||
run: |
|
echo "[INFO] Building Debian $version rootfs..."
|
||||||
docker run --rm --privileged \
|
|
||||||
-v "$(pwd)":/output \
|
image_tag="${registry}/${org}/${repo}:${version}"
|
||||||
fithwum/debian-${{ matrix.version }}-base \
|
|
||||||
bash base-image-script/debian-${{ matrix.version }}_pt1.sh
|
# 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
|
- name: List output archive
|
||||||
run: |
|
run: |
|
||||||
echo "[INFO] Looking for tarballs in workspace..."
|
echo "[INFO] Looking for tarballs in workspace..."
|
||||||
find . -name '*.tar.bz2' -ls
|
find . -name '*.tar.bz2' -ls
|
||||||
|
|
||||||
- name: Push tarball archives to repo
|
- name: Clone and push to Gitea repo
|
||||||
env:
|
env:
|
||||||
GIT_USER: ${{ secrets.GIT_USERNAME }}
|
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
|
||||||
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
|
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
|
||||||
REPO_URL: ${{ secrets.REPO_URL }}
|
REPO_URL: ${{ secrets.REPO_URL }}
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "$GIT_USER"
|
git config --global user.name "$GIT_USERNAME"
|
||||||
git config --global user.email "$GIT_EMAIL"
|
git config --global user.email "$GIT_EMAIL"
|
||||||
|
|
||||||
git clone "$REPO_URL" upload-repo
|
git clone "$REPO_URL" upload-repo
|
||||||
|
|
||||||
# Clean old archives
|
# Remove all old tarballs from upload-repo to avoid clutter
|
||||||
mkdir -p upload-repo/${{ matrix.version }}
|
find upload-repo -name '*.tar.bz2' -type f -delete
|
||||||
find upload-repo/${{ matrix.version }} -name '*.tar.bz2' -type f -delete
|
|
||||||
|
|
||||||
# Find and copy archives
|
# Copy all new tarballs from workspace into upload-repo preserving folder structure
|
||||||
found=$(find . -name '*.tar.bz2')
|
find . -name '*.tar.bz2' -exec bash -c '
|
||||||
if [ -n "$found" ]; then
|
for filepath; do
|
||||||
for filepath in $found; do
|
dir=$(dirname "$filepath")
|
||||||
version_dir=$(dirname "$filepath")
|
mkdir -p "upload-repo/$dir"
|
||||||
mkdir -p upload-repo/"$version_dir"
|
cp "$filepath" "upload-repo/$dir/"
|
||||||
cp "$filepath" upload-repo/"$version_dir"/
|
done
|
||||||
done
|
' bash {} +
|
||||||
|
|
||||||
# Debug list to verify files copied
|
|
||||||
ls -lR upload-repo
|
|
||||||
|
|
||||||
cd upload-repo
|
cd upload-repo
|
||||||
|
git add '**/*.tar.bz2'
|
||||||
git add **/*.tar.bz2
|
|
||||||
|
|
||||||
if git diff --cached --quiet; then
|
if git diff --cached --quiet; then
|
||||||
echo "[INFO] No changes to commit."
|
echo "[INFO] No changes to commit."
|
||||||
@@ -74,11 +77,6 @@ jobs:
|
|||||||
git push
|
git push
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
|
||||||
echo "[WARNING] No .tar.bz2 archive found in workspace!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
build-and-push-docker-images:
|
build-and-push-docker-images:
|
||||||
runs-on: docker-build
|
runs-on: docker-build
|
||||||
needs: build-rootfs-archives
|
needs: build-rootfs-archives
|
||||||
|
|||||||
Reference in New Issue
Block a user