--- name: Build ostree packages from sid to trixie on: push: branches: [main] workflow_dispatch: jobs: build: name: Build ostree packages runs-on: ubuntu-latest container: image: debian:unstable permissions: contents: read packages: write steps: - name: Setup Debian environment run: | echo "Setting up Debian environment for building..." # Install apt-cacher-ng requirements first echo "Installing apt-cacher-ng requirements..." apt update -y apt install -y curl wget # Try apt-cacher-ng first, fallback to Debian's automatic mirror selection echo "Checking for apt-cacher-ng availability..." # Quick check with timeout to avoid hanging if timeout 10 curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then echo "✅ apt-cacher-ng is available, configuring proxy sources..." echo "deb http://192.168.1.101:3142/ftp.debian.org/debian unstable main" > /etc/apt/sources.list echo "deb-src http://192.168.1.101:3142/ftp.us.debian.org/debian unstable main" >> /etc/apt/sources.list else echo "⚠️ apt-cacher-ng not available, using standard Debian mirrors..." echo "deb http://deb.debian.org/debian unstable main" > /etc/apt/sources.list echo "deb-src http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list fi # Update package lists apt update -y # Install essential tools first (including git and editor) apt install -y git curl build-essential fakeroot devscripts nano # Set environment variables for dch export DEBEMAIL="build@particle-os.local" export EMAIL="build@particle-os.local" export EDITOR="nano" - name: Checkout code run: | echo "Cloning repository..." git clone https://git.raines.xyz/particle-os/ostree.git /tmp/ostree cd /tmp/ostree git fetch --all git checkout ${{ github.sha || gitea.sha || 'main' }} - name: Download and extract ostree source run: | echo "Downloading ostree source package..." cd /tmp apt source ostree || { echo "apt source ostree failed!"; exit 1; } cd ostree-* || { echo "Failed to change to ostree directory!"; exit 1; } echo "Changed to ostree directory:" pwd ls -la - name: Install build dependencies run: | echo "Installing build dependencies using apt build-dep..." cd /tmp/ostree-* apt build-dep -y . || { echo "apt build-dep failed!"; exit 1; } - name: Add backport revision number run: | echo "Adding backport revision number..." cd /tmp/ostree-* export DEBEMAIL="build@particle-os.local" export EMAIL="build@particle-os.local" export EDITOR="nano" echo "y" | dch --bpo || echo "dch --bpo failed, continuing..." - name: Build packages run: | echo "Building ostree packages using debuild..." cd /tmp/ostree-* echo "Current directory before build:" pwd ls -la echo "Running debuild -b -us -uc..." if debuild -b -us -uc; then echo "Build successful!" else echo "Build failed! Checking for any partial packages..." ls -la ../*.deb 2>/dev/null || echo "No .deb files found after failed build" exit 1 fi echo "Build completed! Checking for generated packages..." ls -la ../*.deb echo "Copying packages to workspace..." cp ../*.deb /workspace/ 2>/dev/null || echo "No .deb files to copy" - name: Upload to Forgejo Debian Registry run: | echo "Uploading to Forgejo Debian Registry..." cd /tmp/ostree-* echo "Files in current directory:" ls -la echo "Looking for .deb files:" ls -la ../*.deb 2>/dev/null || echo "No .deb files found" # Upload .deb files to Forgejo Debian Registry for deb_file in ../*.deb; do if [ -f "$deb_file" ]; then echo "Uploading $deb_file to Forgejo Debian Registry..." curl -X POST \ --user "${{ secrets.FORGEJO_USERNAME }}:${{ secrets.FORGEJO_TOKEN }}" \ --upload-file "$deb_file" \ "https://git.raines.xyz/api/packages/particle-os/debian/" fi done echo "🎯 Debian package publishing complete!" echo "📦 Packages are now available in Forgejo Debian Registry" echo "🔧 To install: apt install ostree libostree-1-1"