Fix upload to match working composefs CI pattern
All checks were successful
Build ostree packages from sid to trixie / Build ostree packages (push) Successful in 9m47s
All checks were successful
Build ostree packages from sid to trixie / Build ostree packages (push) Successful in 9m47s
- Use ACCESS_TOKEN instead of FORGEJO_USERNAME/FORGEJO_TOKEN - Use --upload-file without -X PUT (automatic PUT method) - Add proper HTTP status code handling and response parsing - Match exact pattern from working composefs CI - This should resolve the reqPackageAccess issue
This commit is contained in:
parent
1fbf60a1a6
commit
d58e983a68
1 changed files with 41 additions and 5 deletions
|
|
@ -118,15 +118,51 @@ jobs:
|
||||||
echo "Looking for .deb files:"
|
echo "Looking for .deb files:"
|
||||||
ls -la ../*.deb 2>/dev/null || echo "No .deb files found"
|
ls -la ../*.deb 2>/dev/null || echo "No .deb files found"
|
||||||
|
|
||||||
|
# Set Forgejo configuration (matching composefs CI)
|
||||||
|
FORGEJO_OWNER="particle-os"
|
||||||
|
FORGEJO_DISTRIBUTION="trixie"
|
||||||
|
FORGEJO_COMPONENT="main"
|
||||||
|
|
||||||
# Upload .deb files to Forgejo Debian Registry
|
# Upload .deb files to Forgejo Debian Registry
|
||||||
for deb_file in ../*.deb; do
|
for deb_file in ../*.deb; do
|
||||||
if [ -f "$deb_file" ]; then
|
if [ -f "$deb_file" ]; then
|
||||||
echo "Uploading $deb_file to Forgejo Debian Registry..."
|
echo "Uploading $deb_file to Forgejo Debian Registry..."
|
||||||
UPLOAD_URL="https://git.raines.xyz/api/packages/particle-os/debian/pool/trixie/main/upload"
|
UPLOAD_URL="https://git.raines.xyz/api/packages/${FORGEJO_OWNER}/debian/pool/${FORGEJO_DISTRIBUTION}/${FORGEJO_COMPONENT}/upload"
|
||||||
curl -X PUT \
|
echo " Upload URL: $UPLOAD_URL"
|
||||||
--user "${{ secrets.FORGEJO_USERNAME }}:${{ secrets.FORGEJO_TOKEN }}" \
|
|
||||||
--upload-file "$deb_file" \
|
# Use the same pattern as composefs CI
|
||||||
"$UPLOAD_URL"
|
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)
|
||||||
|
|
||||||
|
echo " HTTP Status: $HTTP_CODE"
|
||||||
|
case $HTTP_CODE in
|
||||||
|
201)
|
||||||
|
echo " ✅ Package uploaded successfully"
|
||||||
|
;;
|
||||||
|
409)
|
||||||
|
echo " ⚠️ Package already exists (version conflict)"
|
||||||
|
;;
|
||||||
|
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"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue