#!/bin/bash # # Uploads built .deb packages to a Gitea Debian package registry. # # Required env: # DEB_USER - Gitea username (token owner) # DEB_PASS - Gitea access token with the write:package scope # # Optional env (defaults target git.ahax86.ru / owner "pub"): # DEB_REGISTRY - registry base URL # DEB_DISTRIBUTION - apt distribution (default: noble) # DEB_COMPONENT - apt component (default: main) # set -euo pipefail DEB_REGISTRY="${DEB_REGISTRY:-https://git.ahax86.ru/api/packages/pub/debian}" DEB_DISTRIBUTION="${DEB_DISTRIBUTION:-noble}" DEB_COMPONENT="${DEB_COMPONENT:-main}" if [ -z "${DEB_USER:-}" ] || [ -z "${DEB_PASS:-}" ]; then echo "DEB_USER and DEB_PASS must be set" >&2 exit 1 fi upload_url="${DEB_REGISTRY}/pool/${DEB_DISTRIBUTION}/${DEB_COMPONENT}/upload" shopt -s nullglob debs=(*.deb) if [ "${#debs[@]}" -eq 0 ]; then echo "No .deb files found to upload" >&2 exit 1 fi for file in "${debs[@]}"; do echo "Uploading ${file} -> ${upload_url}" curl -fsSL --user "${DEB_USER}:${DEB_PASS}" \ --upload-file "./${file}" \ "${upload_url}" done echo "Uploaded ${#debs[@]} package(s)"