name: Build libostree Backport on: push: branches: [ main, master ] pull_request: branches: [ main, master ] workflow_dispatch: env: UBUNTU_VERSION: "24.04" OSTREE_VERSION: "2025.2" BACKPORT_SUFFIX: "~noble1" jobs: build-libostree-backport: name: Build libostree Backport runs-on: ubuntu-latest container: image: ubuntu:latest steps: - name: Setup build environment run: | apt update -y apt install -y devscripts build-essential wget git - name: Checkout repository manually run: | # Clone the repository manually instead of using actions/checkout git clone https://git.raines.xyz/robojerk/libostree-dev.git /tmp/libostree-dev cp -r /tmp/libostree-dev/* . cp -r /tmp/libostree-dev/.* . 2>/dev/null || true - name: Add source repositories run: | echo "deb-src http://us.archive.ubuntu.com/ubuntu/ noble main universe" | tee /etc/apt/sources.list.d/noble-sources.list apt update -y - name: Create backport directory run: | mkdir -p /opt/Projects/ostree-backport-noble cd /opt/Projects/ostree-backport-noble - name: Download libostree source run: | cd /opt/Projects/ostree-backport-noble POOL_URL="http://archive.ubuntu.com/ubuntu/pool/universe/o/ostree/" wget "${POOL_URL}ostree_${OSTREE_VERSION}-1.dsc" wget "${POOL_URL}ostree_${OSTREE_VERSION}.orig.tar.xz" wget "${POOL_URL}ostree_${OSTREE_VERSION}-1.debian.tar.xz" - name: Extract and modify source run: | cd /opt/Projects/ostree-backport-noble dpkg-source -x "ostree_${OSTREE_VERSION}-1.dsc" cd "ostree-${OSTREE_VERSION}" dch --newversion "${OSTREE_VERSION}-1${BACKPORT_SUFFIX}" \ --distribution "noble-backports" \ -b \ "Backport libostree ${OSTREE_VERSION}-1 from Ubuntu questing for bootc compatibility." - name: Install build dependencies run: | cd /opt/Projects/ostree-backport-noble/ostree-${OSTREE_VERSION} export DEBIAN_FRONTEND=noninteractive export APT_LISTCHANGES_FRONTEND=none apt-get update apt-get build-dep -y --no-install-recommends ./ - name: Build libostree backport run: | cd /opt/Projects/ostree-backport-noble/ostree-${OSTREE_VERSION} dpkg-buildpackage -us -uc -b - name: List built packages run: | echo "Built libostree packages:" ls -la /opt/Projects/ostree-backport-noble/*.deb - name: Create release assets run: | mkdir -p release-assets cp /opt/Projects/ostree-backport-noble/*.deb release-assets/ # Create a summary file echo "libostree Backport Build Summary" > release-assets/BUILD_SUMMARY.txt echo "===============================" >> release-assets/BUILD_SUMMARY.txt echo "Build Date: $(date)" >> release-assets/BUILD_SUMMARY.txt echo "Ubuntu Version: ${UBUNTU_VERSION}" >> release-assets/BUILD_SUMMARY.txt echo "Ostree Version: ${OSTREE_VERSION}" >> release-assets/BUILD_SUMMARY.txt echo "Backport Suffix: ${BACKPORT_SUFFIX}" >> release-assets/BUILD_SUMMARY.txt echo "" >> release-assets/BUILD_SUMMARY.txt echo "Built Packages:" >> release-assets/BUILD_SUMMARY.txt ls -la release-assets/*.deb 2>/dev/null || echo "No packages found" >> release-assets/BUILD_SUMMARY.txt # Create package list for download links echo "Package List:" > release-assets/PACKAGES.txt ls -1 release-assets/*.deb 2>/dev/null | sed 's|.*/||' >> release-assets/PACKAGES.txt echo "Release assets created:" ls -la release-assets/ - name: Create download instructions run: | cat > release-assets/INSTALL.md << EOF # libostree 2025.2-1 Backport Installation ## Quick Install \`\`\`bash # Download and install the main package wget https://git.raines.xyz/robojerk/libostree-dev/actions/runs/\${{ github.run_id }}/artifacts sudo dpkg -i libostree-dev_2025.2-1~noble1_amd64.deb sudo apt-get install -f \`\`\` ## Verification \`\`\`bash # Check if libostree 2025.2-1 is installed pkg-config --modversion ostree-1 # Should output: 2025.2 \`\`\` ## Packages Included EOF ls -1 release-assets/*.deb 2>/dev/null | sed 's|.*/||' | while read package; do echo "- \`$package\`" >> release-assets/INSTALL.md done echo "" >> release-assets/INSTALL.md echo "Build completed on: $(date)" >> release-assets/INSTALL.md - name: Install curl for package upload run: | apt-get update -y apt-get install -y curl - name: Upload to Debian Package Registry run: | # Upload each .deb package to Forgejo's Debian Package Registry for deb_file in release-assets/*.deb; do if [ -f "$deb_file" ]; then echo "Uploading $deb_file to Debian Package Registry..." # Upload to Forgejo's Debian Package Registry using the correct API # POST /api/v1/repos/{owner}/{repo}/packages/debian curl -X POST \ -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \ -F "file=@$deb_file" \ -F "distribution=noble" \ -F "component=main" \ "https://git.raines.xyz/api/v1/repos/robojerk/libostree-dev/packages/debian" echo "Upload completed for $deb_file" fi done