test: add API endpoint testing to debug package registry issues
All checks were successful
Build libostree Backport / Build libostree Backport (push) Successful in 9m40s
All checks were successful
Build libostree Backport / Build libostree Backport (push) Successful in 9m40s
This commit is contained in:
parent
fff0774835
commit
2f2b46581d
1 changed files with 40 additions and 11 deletions
|
|
@ -138,21 +138,50 @@ jobs:
|
|||
apt-get update -y
|
||||
apt-get install -y curl
|
||||
|
||||
- name: Upload to Debian Package Registry
|
||||
- name: Test API endpoints
|
||||
run: |
|
||||
# Upload each .deb package to Forgejo's Debian Package Registry
|
||||
echo "=== Testing Forgejo API endpoints ==="
|
||||
|
||||
# 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 Generic Package Registry (Fallback)
|
||||
run: |
|
||||
# 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 Debian Package Registry..."
|
||||
echo "Uploading $deb_file to Generic 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"
|
||||
# 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 "Upload completed for $deb_file"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue