fix: use correct Forgejo API authentication with ACCESS_TOKEN
All checks were successful
Build libostree Backport / Build libostree Backport (push) Successful in 9m52s

Update workflow to use proper Forgejo API authentication format:
- Use Authorization: token header as per Forgejo documentation
- Reference ACCESS_TOKEN secret instead of GITEA_TOKEN
- Add explicit PUT method and correct Content-Type header
- Update README with Debian Package Registry installation instructions

This should resolve authentication issues and enable successful package uploads
to the Forgejo Debian Package Registry.
This commit is contained in:
robojerk 2025-07-21 05:27:20 +00:00
parent 8033048adf
commit e2eee01d08
2 changed files with 44 additions and 74 deletions

View file

@ -133,66 +133,27 @@ jobs:
echo "" >> release-assets/INSTALL.md
echo "Build completed on: $(date)" >> release-assets/INSTALL.md
- name: Create download page
- name: Install curl for package upload
run: |
# Create a simple download page in the workspace
mkdir -p /workspace/robojerk/libostree-dev/downloads
cp -r release-assets/* /workspace/robojerk/libostree-dev/downloads/
# Create an index.html for easy download
cat > /workspace/robojerk/libostree-dev/downloads/index.html << EOF
<!DOCTYPE html>
<html>
<head>
<title>libostree-dev Downloads</title>
<style>
body { font-family: Arial, sans-serif; margin: 40px; }
.package { background: #f5f5f5; padding: 10px; margin: 10px 0; border-radius: 5px; }
.download { background: #4CAF50; color: white; padding: 8px 16px; text-decoration: none; border-radius: 3px; }
.download:hover { background: #45a049; }
</style>
</head>
<body>
<h1>libostree-dev 2025.2-1~noble1 Downloads</h1>
<p><strong>Build completed:</strong> $(date)</p>
<p><strong>Ubuntu Version:</strong> ${UBUNTU_VERSION}</p>
<p><strong>Ostree Version:</strong> ${OSTREE_VERSION}</p>
<h2>Available Packages:</h2>
EOF
ls -1 release-assets/*.deb 2>/dev/null | sed 's|.*/||' | while read package; do
size=$(ls -lh release-assets/"$package" | awk '{print $5}')
echo " <div class=\"package\">" >> /workspace/robojerk/libostree-dev/downloads/index.html
echo " <strong>$package</strong> ($size)<br>" >> /workspace/robojerk/libostree-dev/downloads/index.html
echo " <a href=\"$package\" class=\"download\">Download</a>" >> /workspace/robojerk/libostree-dev/downloads/index.html
echo " </div>" >> /workspace/robojerk/libostree-dev/downloads/index.html
done
cat >> /workspace/robojerk/libostree-dev/downloads/index.html << EOF
<h2>Installation Instructions:</h2>
<pre># Download and install the main package
sudo dpkg -i libostree-dev_2025.2-1~noble1_amd64.deb
sudo apt-get install -f
apt-get update -y
apt-get install -y curl
# Verify installation
pkg-config --modversion ostree-1
# Should output: 2025.2</pre>
- name: Upload to Debian Package Registry
run: |
# 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..."
<h2>Package Details:</h2>
<ul>
<li><strong>libostree-dev_2025.2-1~noble1_amd64.deb</strong> - Main development package (required for bootc)</li>
<li><strong>libostree-1-1_2025.2-1~noble1_amd64.deb</strong> - Runtime library</li>
<li><strong>ostree_2025.2-1~noble1_amd64.deb</strong> - Command line tools</li>
<li><strong>ostree-boot_2025.2-1~noble1_amd64.deb</strong> - Boot utilities</li>
<li><strong>ostree-tests_2025.2-1~noble1_amd64.deb</strong> - Test suite</li>
<li><strong>libostree-doc_2025.2-1~noble1_all.deb</strong> - Documentation</li>
<li><strong>gir1.2-ostree-1.0_2025.2-1~noble1_amd64.deb</strong> - GObject introspection</li>
</ul>
</body>
</html>
EOF
echo "Download page created at: /workspace/robojerk/libostree-dev/downloads/"
ls -la /workspace/robojerk/libostree-dev/downloads/
# Upload to Forgejo's Debian Package Registry using correct API
# PUT https://forgejo.example.com/api/packages/{owner}/debian/pool/{distribution}/{component}/upload
# Using Authorization: token header as per Forgejo documentation
curl -X PUT \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
-H "Content-Type: application/vnd.debian.binary-package" \
--upload-file "$deb_file" \
"https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload"
echo "Upload completed for $deb_file"
fi
done