refactor: Switch from Packages API to Releases API for distribution
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
- Replace upload_to_packages scripts with create_release scripts - Use Forgejo Releases API instead (standard for binaries) - Windows: create_release.ps1 creates release and uploads exe + checksum - macOS: create_release.sh creates release and uploads dmg + checksum - Interactive credential prompts on first run - UpdateManager queries releases/latest for updates - Much simpler and matches standard open-source distribution - Rename FORGEJO_PACKAGES_SETUP.md to reflect Releases approach - Update documentation with Releases API examples
This commit is contained in:
parent
9c8a8d269c
commit
72b0cfb496
3 changed files with 257 additions and 200 deletions
|
|
@ -1,121 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Upload macOS Build to Forgejo Packages
|
||||
# Usage: ./upload_to_packages.sh -v 1.0.0
|
||||
# Uses your Forgejo credentials (same as git)
|
||||
# First run will prompt for credentials and save them to this session
|
||||
|
||||
set -e
|
||||
|
||||
# Parse arguments
|
||||
VERSION=""
|
||||
FORGEJO_USER=""
|
||||
FORGEJO_PASS=""
|
||||
FORGEJO_URL="https://git.him-tools.de"
|
||||
REPO="HIM-public/webdrop-bridge"
|
||||
DMG_PATH="build/dist/macos/WebDropBridge.dmg"
|
||||
CHECKSUM_PATH="build/dist/macos/WebDropBridge.dmg.sha256"
|
||||
CLEAR_CREDS=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-v|--version) VERSION="$2"; shift 2;;
|
||||
-u|--url) FORGEJO_URL="$2"; shift 2;;
|
||||
--clear-credentials) CLEAR_CREDS=true; shift;;
|
||||
*) echo "Unknown option: $1"; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Handle --clear-credentials flag
|
||||
if [ "$CLEAR_CREDS" = true ]; then
|
||||
unset FORGEJO_USER
|
||||
unset FORGEJO_PASS
|
||||
echo "[OK] Credentials cleared from this session"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Load credentials from environment
|
||||
FORGEJO_USER="${FORGEJO_USER}"
|
||||
FORGEJO_PASS="${FORGEJO_PASS}"
|
||||
|
||||
# Verify required parameters
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "ERROR: Version parameter required" >&2
|
||||
echo "Usage: $0 -v VERSION [-u FORGEJO_URL]" >&2
|
||||
echo "Example: $0 -v 1.0.0" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If no credentials, prompt user interactively
|
||||
if [ -z "$FORGEJO_USER" ] || [ -z "$FORGEJO_PASS" ]; then
|
||||
echo "Forgejo credentials not found. Enter your credentials:"
|
||||
|
||||
if [ -z "$FORGEJO_USER" ]; then
|
||||
read -p "Username: " FORGEJO_USER
|
||||
fi
|
||||
|
||||
if [ -z "$FORGEJO_PASS" ]; then
|
||||
read -sp "Password: " FORGEJO_PASS
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Export for this session
|
||||
export FORGEJO_USER
|
||||
export FORGEJO_PASS
|
||||
echo "[OK] Credentials saved to this shell session"
|
||||
echo "Tip: Credentials will persist until you close the terminal or run: $0 --clear-credentials"
|
||||
fi
|
||||
|
||||
echo "Uploading WebDropBridge $VERSION to Forgejo Packages..."
|
||||
|
||||
# Get file info
|
||||
DMG_SIZE=$(du -m "$DMG_PATH" | cut -f1)
|
||||
CHECKSUM=$(cat "$CHECKSUM_PATH")
|
||||
|
||||
echo "File: WebDropBridge.dmg ($DMG_SIZE MB)"
|
||||
echo "Checksum: ${CHECKSUM:0:16}..."
|
||||
|
||||
# Create basic auth header
|
||||
BASIC_AUTH=$(echo -n "${FORGEJO_USER}:${FORGEJO_PASS}" | base64)
|
||||
|
||||
# Upload DMG
|
||||
echo ""
|
||||
echo "Uploading DMG..."
|
||||
DMG_URL="$FORGEJO_URL/api/v1/repos/$REPO/packages/generic/webdrop-bridge/$VERSION/WebDropBridge.dmg"
|
||||
|
||||
HTTP_CODE=$(curl -s -w "%{http_code}" -X PUT \
|
||||
-H "Authorization: Basic $BASIC_AUTH" \
|
||||
--data-binary "@$DMG_PATH" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
"$DMG_URL" \
|
||||
-o /tmp/curl_response.txt)
|
||||
|
||||
if [ "$HTTP_CODE" -eq 201 ] || [ "$HTTP_CODE" -eq 200 ]; then
|
||||
echo "✓ DMG uploaded successfully"
|
||||
else
|
||||
echo "ERROR uploading DMG (HTTP $HTTP_CODE)"
|
||||
cat /tmp/curl_response.txt
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Upload checksum
|
||||
echo "Uploading checksum..."
|
||||
CHECKSUM_URL="$FORGEJO_URL/api/v1/repos/$REPO/packages/generic/webdrop-bridge/$VERSION/WebDropBridge.dmg.sha256"
|
||||
|
||||
HTTP_CODE=$(curl -s -w "%{http_code}" -X PUT \
|
||||
-H "Authorization: Basic $BASIC_AUTH" \
|
||||
-d "$CHECKSUM" \
|
||||
-H "Content-Type: text/plain" \
|
||||
"$CHECKSUM_URL" \
|
||||
-o /tmp/curl_response.txt)
|
||||
|
||||
if [ "$HTTP_CODE" -eq 201 ] || [ "$HTTP_CODE" -eq 200 ]; then
|
||||
echo "✓ Checksum uploaded successfully"
|
||||
else
|
||||
echo "ERROR uploading checksum (HTTP $HTTP_CODE)"
|
||||
cat /tmp/curl_response.txt
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✓ Upload complete!"
|
||||
echo "View at: $FORGEJO_URL/$REPO/packages"
|
||||
Loading…
Add table
Add a link
Reference in a new issue