libostree-dev/.forgejo/workflows/build-libostree-backport.yml
robojerk f040922759
All checks were successful
Build libostree Backport / Build libostree Backport (push) Successful in 10m1s
Add proper Debian Package Registry upload method with fallback to Generic Registry. I hate this, nothing works.
2025-07-21 08:09:32 +00:00

214 lines
No EOL
8.4 KiB
YAML

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: Test API endpoints
run: |
echo "=== Testing Forgejo API endpoints with updated token ==="
# Test 1: Check if the Debian Package Registry endpoint exists
echo "Testing Debian Package Registry endpoint..."
curl -v -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/libostree-dev/packages/debian" 2>&1
echo ""
echo "=== Testing Generic Package Registry endpoint ==="
# Test 2: Check if the Generic Package Registry endpoint exists
curl -v -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
"https://git.raines.xyz/api/v1/packages/robojerk/generic" 2>&1
echo ""
echo "=== Testing repository packages endpoint ==="
# Test 3: Check repository packages endpoint
curl -v -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/libostree-dev/packages" 2>&1
- name: Upload to Debian Package Registry (Primary)
run: |
echo "=== Attempting Debian Package Registry upload ==="
# 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..."
# Extract filename for the package
filename=$(basename "$deb_file")
echo "File: $filename"
# Upload to Forgejo's Debian Package Registry using proper endpoint
# PUT https://forgejo.example.com/api/packages/{owner}/debian/pool/{distribution}/{component}/upload
curl --user "robojerk:${{ secrets.ACCESS_TOKEN }}" \
--upload-file "$deb_file" \
"https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload"
echo "Debian Package Registry upload completed for $deb_file"
fi
done
- name: Upload to Generic Package Registry (Fallback)
run: |
echo "=== Attempting Generic Package Registry upload (fallback) ==="
# Upload each .deb package to Forgejo's Generic Package Registry
for deb_file in release-assets/*.deb; do
if [ -f "$deb_file" ]; then
echo "Uploading $deb_file to Generic Package Registry..."
# Extract filename for the package
filename=$(basename "$deb_file")
package_name=$(echo "$filename" | cut -d'_' -f1)
version=$(echo "$filename" | cut -d'_' -f2 | cut -d'~' -f1)
echo "Package: $package_name"
echo "Version: $version"
echo "File: $filename"
# Upload to Forgejo's Generic Package Registry
# PUT https://forgejo.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name}
curl --user "robojerk:${{ secrets.ACCESS_TOKEN }}" \
--upload-file "$deb_file" \
"https://git.raines.xyz/api/packages/robojerk/generic/$package_name/$version/$filename"
echo "Generic Package Registry upload completed for $deb_file"
fi
done