Add Debian packaging and update Forgejo workflow
Some checks failed
Build deb-bootupd Artifacts / build (push) Failing after 6m14s
Simple Build and Upload / build (push) Failing after 2m0s

- Add complete Debian packaging configuration (debian/ directory)
- Create build-deb.sh script for building packages
- Update Forgejo workflow to build and upload .deb artifacts
- Add comprehensive version naming for both binary and Debian artifacts
- Update .gitignore to exclude build artifacts and packaging files
- Add PACKAGING.md documentation
- Add test-deb.sh for testing package installation
This commit is contained in:
robojerk 2025-08-10 11:30:19 -07:00
parent ff974a9d4a
commit 73b43239e9
19 changed files with 705 additions and 21 deletions

View file

@ -124,9 +124,9 @@ jobs:
git clone https://git.raines.xyz/robojerk/deb-bootupd.git /tmp/deb-bootupd
cd /tmp/deb-bootupd
echo "Repository: $(git remote get-url origin)"
echo "Branch: $(git branch --show-current)"
echo "Commit: $(git rev-parse --short HEAD)"
echo "Repository: ${GITHUB_REPOSITORY:-$(git remote get-url origin 2>/dev/null || echo "unknown")}"
echo "Branch: ${GITHUB_REF_NAME:-$(git branch --show-current 2>/dev/null || echo "unknown")}"
echo "Commit: ${GITHUB_SHA:-$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")}"
# Verify Rust version meets requirements (need 1.84.1+)
RUST_VERSION=$(rustc --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -1)
@ -254,6 +254,49 @@ jobs:
ls -la artifacts/
ls -la *.zip
- name: Build Debian package
run: |
cd /tmp/deb-bootupd
echo "=== BUILDING DEBIAN PACKAGE ==="
# Install Debian packaging dependencies
apt update -y
apt install -y devscripts dh-cargo build-essential
# Verify debian packaging files
echo "Debian packaging files:"
ls -la debian/
# Build the Debian package
echo "Building Debian package..."
./build-deb.sh
# Check what was built
echo "Package build results:"
ls -la ../*.deb ../*.buildinfo ../*.changes ../*.dsc 2>/dev/null || echo "No package files found in parent directory"
# Create debian artifacts directory
mkdir -p debian-artifacts
# Copy all package files
cp ../*.deb ../*.buildinfo ../*.changes ../*.dsc debian-artifacts/ 2>/dev/null || echo "No package files to copy"
# Create debian package archive
cd debian-artifacts
if [ -n "$(ls -A .)" ]; then
# Create versioned artifact name matching the binary artifact pattern
VERSIONED_DEBIAN_ARTIFACT="deb-bootupd-debian-${BOOTUPD_VERSION}-${FORK_VERSION}-${TARGET_PLATFORM}-$(git rev-parse --short HEAD).zip"
zip -r "../$VERSIONED_DEBIAN_ARTIFACT" .
echo "✅ Debian package artifacts created"
echo "📦 Versioned Debian artifact: $VERSIONED_DEBIAN_ARTIFACT"
ls -la ../*.zip
else
echo "❌ No Debian package files found"
exit 1
fi
cd ..
- name: Upload artifacts to Forgejo
env:
USER: robojerk
@ -299,15 +342,55 @@ jobs:
"$upload_url" 2>&1
exit 1
fi
# Upload Debian package
echo "Uploading Debian package to Forgejo Package Registry..."
VERSIONED_DEBIAN_ARTIFACT="deb-bootupd-debian-${BOOTUPD_VERSION}-${FORK_VERSION}-${TARGET_PLATFORM}-$(git rev-parse --short HEAD).zip"
if [ -f "$VERSIONED_DEBIAN_ARTIFACT" ]; then
# Create Debian package path
debian_path="api/packages/robojerk/generic/deb-bootupd-debian/${BOOTUPD_VERSION}-${FORK_VERSION}-${TARGET_PLATFORM}"
debian_upload_url="https://${BASE_URL}/${debian_path}/${VERSIONED_DEBIAN_ARTIFACT}"
echo "Debian package upload URL: $debian_upload_url"
echo "Debian package path: $debian_path"
# Upload Debian package
debian_http_code=$(curl -s -o /dev/null -w "%{http_code}" \
--user "${USER}:${TOKEN}" \
--upload-file "$VERSIONED_DEBIAN_ARTIFACT" \
"$debian_upload_url")
echo "Debian package HTTP Response Code: $debian_http_code"
if [ "$debian_http_code" = "201" ]; then
echo "✅ Debian package uploaded successfully to Forgejo Package Registry"
echo "📦 Debian package available at: https://${BASE_URL}/robojerk/-/packages/generic/deb-bootupd-debian"
elif [ "$debian_http_code" = "409" ]; then
echo "➡️ INFO: Debian package already exists (HTTP 409 Conflict)"
else
echo "❌ Debian package upload failed with HTTP $debian_http_code"
# Show verbose output for debugging
curl -v -i --user "${USER}:${TOKEN}" \
--upload-file "$VERSIONED_DEBIAN_ARTIFACT" \
"$debian_upload_url" 2>&1
exit 1
fi
else
echo "❌ Debian package artifact not found: $VERSIONED_DEBIAN_ARTIFACT"
exit 1
fi
- name: Create release assets
run: |
cd /tmp/deb-bootupd
VERSIONED_ARTIFACT="bootupd-${BOOTUPD_VERSION}-${FORK_VERSION}-${TARGET_PLATFORM}-$(git rev-parse --short HEAD).zip"
VERSIONED_DEBIAN_ARTIFACT="deb-bootupd-debian-${BOOTUPD_VERSION}-${FORK_VERSION}-${TARGET_PLATFORM}-$(git rev-parse --short HEAD).zip"
mkdir -p release-assets
cp "$VERSIONED_ARTIFACT" release-assets/ 2>/dev/null || echo "No versioned artifact found"
cp "$VERSIONED_DEBIAN_ARTIFACT" release-assets/ 2>/dev/null || echo "No Debian artifact found"
# Create a summary file
cat > release-assets/BUILD_SUMMARY.txt << EOF
@ -320,8 +403,8 @@ jobs:
Debian Version: ${DEBIAN_VERSION}
Container Image: rust:1.89-slim-trixie
Rust Version: $(rustc --version)
Git Commit: $(git rev-parse --short HEAD)
Git Branch: $(git branch --show-current)
Git Commit: ${GITHUB_SHA:-$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")}
Git Branch: ${GITHUB_REF_NAME:-$(git branch --show-current 2>/dev/null || echo "unknown")}
Built Artifacts:
- Rust binary (release mode): bootupd
@ -329,10 +412,17 @@ jobs:
- Archive Size: $(ls -lh "$VERSIONED_ARTIFACT" | awk '{print $5}')
- Compression: 77% (from binary to archive)
Artifact Archive: $VERSIONED_ARTIFACT
Debian Package:
- Package Archive: $VERSIONED_DEBIAN_ARTIFACT
- Package Size: $(ls -lh "$VERSIONED_DEBIAN_ARTIFACT" | awk '{print $5}')
Package Registry:
https://git.raines.xyz/robojerk/-/packages/generic/deb-bootupd
Artifact Archives:
- Binary: $VERSIONED_ARTIFACT
- Debian: $VERSIONED_DEBIAN_ARTIFACT
Package Registries:
- Binary: https://git.raines.xyz/robojerk/-/packages/generic/deb-bootupd
- Debian: https://git.raines.xyz/robojerk/-/packages/generic/deb-bootupd-debian
EOF
echo "Release assets created:"
@ -341,21 +431,25 @@ jobs:
- name: Success Summary
run: |
VERSIONED_ARTIFACT="bootupd-${BOOTUPD_VERSION}-${FORK_VERSION}-${TARGET_PLATFORM}-$(git rev-parse --short HEAD).zip"
VERSIONED_DEBIAN_ARTIFACT="deb-bootupd-debian-${BOOTUPD_VERSION}-${FORK_VERSION}-${TARGET_PLATFORM}-$(git rev-parse --short HEAD).zip"
echo "=== Build Summary ==="
echo "✅ deb-bootupd compiled successfully in release mode"
echo "✅ All tests passed"
echo "✅ Code formatting and linting passed"
echo "✅ Build artifacts created and uploaded to Forgejo"
echo "✅ Debian package built and uploaded to Forgejo"
echo ""
echo "📦 Versioned Artifact: $VERSIONED_ARTIFACT"
echo "📦 Binary Artifact: $VERSIONED_ARTIFACT"
echo "📦 Debian Package: $VERSIONED_DEBIAN_ARTIFACT"
echo "🎯 Package Structure: bootupd-${BOOTUPD_VERSION}-${FORK_VERSION}-${TARGET_PLATFORM}"
echo ""
echo "📦 Artifacts available at:"
echo " https://git.raines.xyz/robojerk/-/packages/generic/deb-bootupd"
echo " Binary: https://git.raines.xyz/robojerk/-/packages/generic/deb-bootupd"
echo " Debian: https://git.raines.xyz/robojerk/-/packages/generic/deb-bootupd-debian"
echo ""
echo "🎯 Next steps:"
echo " - Verify artifacts appear in repository packages page"
echo " - Test binaries on Debian Trixie systems"
echo " - Consider building .deb packages for distribution"
echo " - Test Debian package installation on target systems"
echo " - Update version numbers for future releases"

View file

@ -122,9 +122,9 @@ jobs:
git clone https://git.raines.xyz/robojerk/deb-bootupd.git /tmp/deb-bootupd
cd /tmp/deb-bootupd
echo "Repository: $(git remote get-url origin)"
echo "Branch: $(git branch --show-current)"
echo "Commit: $(git rev-parse --short HEAD)"
echo "Repository: ${GITHUB_REPOSITORY:-$(git remote get-url origin 2>/dev/null || echo "unknown")}"
echo "Branch: ${GITHUB_REF_NAME:-$(git branch --show-current 2>/dev/null || echo "unknown")}"
echo "Commit: ${GITHUB_SHA:-$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")}"
# Verify Rust version meets requirements (need 1.84.1+)
RUST_VERSION=$(rustc --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -1)