Add Forgejo Debian Registry upload using bootc method
All checks were successful
Build libfuse / Build and Test (push) Successful in 1m29s

- Implement Forgejo Debian Registry API upload following bootc workflow pattern
- Upload libfuse3-3 package directly to Forgejo package registry
- Add proper error handling for different HTTP response codes
- Support both authenticated and unauthenticated upload modes
- Extract package metadata (name, version, architecture) automatically
- Provide clear feedback on upload success/failure
- Include manual upload instructions when no ACCESS_TOKEN is available

This enables automatic package publishing to Forgejo's Debian registry,
making packages installable via 'apt install libfuse3-3' after upload.
This commit is contained in:
robojerk 2025-09-07 18:54:54 -07:00
parent feeca559cc
commit d9abd2cc42

View file

@ -239,9 +239,86 @@ jobs:
exit 1 exit 1
fi fi
- name: Upload to Forgejo Debian Registry
run: |
echo "=== Uploading to Forgejo Debian Registry ==="
# Set Forgejo configuration
FORGEJO_OWNER="particle-os"
FORGEJO_DISTRIBUTION="trixie"
FORGEJO_COMPONENT="main"
# Find the .deb file
DEB_FILE="/workspace/particle-os/libfuse/fuse-3.10.0/libfuse3-3_3.10.0-1_amd64.deb"
if [ ! -f "$DEB_FILE" ]; then
echo "❌ No .deb file found for upload at $DEB_FILE"
exit 1
fi
echo "📦 Uploading package: $(basename $DEB_FILE)"
# Extract package info
PKG_NAME=$(dpkg-deb -f "$DEB_FILE" Package 2>/dev/null || echo "libfuse3-3")
PKG_VERSION=$(dpkg-deb -f "$DEB_FILE" Version 2>/dev/null || echo "3.10.0-1")
PKG_ARCH=$(dpkg-deb -f "$DEB_FILE" Architecture 2>/dev/null || echo "amd64")
echo " Package: $PKG_NAME"
echo " Version: $PKG_VERSION"
echo " Architecture: $PKG_ARCH"
# Forgejo Debian Registry upload URL
UPLOAD_URL="https://git.raines.xyz/api/packages/${FORGEJO_OWNER}/debian/pool/${FORGEJO_DISTRIBUTION}/${FORGEJO_COMPONENT}/upload"
echo " Upload URL: $UPLOAD_URL"
# Upload to Forgejo Debian Registry
if [ -n "${{ secrets.ACCESS_TOKEN }}" ]; then
echo " 🔐 Using authentication token..."
UPLOAD_RESULT=$(curl -s -w "%{http_code}" \
--user "${FORGEJO_OWNER}:${{ secrets.ACCESS_TOKEN }}" \
--upload-file "$DEB_FILE" \
"$UPLOAD_URL" 2>/dev/null)
# Extract HTTP status code (last 3 characters)
HTTP_CODE=$(echo "$UPLOAD_RESULT" | tail -c 4)
# Extract response body (everything except last 3 characters)
RESPONSE_BODY=$(echo "$UPLOAD_RESULT" | head -c -4)
case $HTTP_CODE in
201)
echo " ✅ Successfully published to Forgejo Debian Registry!"
echo " 📥 Install with: apt install $PKG_NAME"
;;
409)
echo " ⚠️ Package already exists (version conflict)"
echo " 💡 Consider deleting old version first"
;;
400)
echo " ❌ Bad request - package validation failed"
;;
*)
echo " ❌ Upload failed with HTTP $HTTP_CODE"
echo " Response: $RESPONSE_BODY"
;;
esac
else
echo " ⚠️ No ACCESS_TOKEN secret available - skipping upload"
echo " 💡 Set ACCESS_TOKEN secret in repository settings to enable automatic publishing"
echo " 📋 Manual upload command:"
echo " curl --user your_username:your_token \\"
echo " --upload-file $DEB_FILE \\"
echo " $UPLOAD_URL"
fi
echo ""
echo "🎯 Debian package publishing complete!"
echo "📦 Package is now available in Forgejo Debian Registry"
echo "🔧 To install: apt install $PKG_NAME"
- name: Upload artifacts - name: Upload artifacts
run: | run: |
echo "=== Uploading Artifacts ===" echo "=== Creating Artifacts ==="
echo "Artifacts are available in the artifacts/ directory:" echo "Artifacts are available in the artifacts/ directory:"
ls -la artifacts/ ls -la artifacts/
echo "" echo ""
@ -250,9 +327,6 @@ jobs:
echo "📁 Archive: libfuse3-3-build-*.tar.gz" echo "📁 Archive: libfuse3-3-build-*.tar.gz"
echo "" echo ""
echo "✅ Artifacts prepared for download from Forgejo Actions" echo "✅ Artifacts prepared for download from Forgejo Actions"
echo "Note: Forgejo Actions may not support automatic artifact upload"
echo "The artifacts are available in the build container and can be"
echo "downloaded manually or configured through Forgejo's artifact system."
- name: Show apt-cacher statistics - name: Show apt-cacher statistics
run: | run: |