automate/utils/push-deb-to-gitea2.sh

33 lines
1.1 KiB
Bash

#!/usr/bin/env bash
set -x
USERNAME="cyteen"
PASSWORD="mlpfinsonik"
DISTRIBUTION="ceres"
COMPONENT="main"
# Extract the architecture from the filename
DEB_FILE="$1"
ARCHITECTURE="${DEB_FILE%.*}" # Remove the.deb extension to get the architecture
# Validate the architecture
if [[ $ARCHITECTURE =~ ^(amd64|arm64)$ ]]; then
echo "Invalid architecture. Must be either amd64 or arm64."
exit 1
fi
# Construct the GITEA URL based on the architecture
GITEA_URL="https://git2.ring-zero.co.uk/api/packages/${USERNAME}/debian/pool/${DISTRIBUTION}/${COMPONENT}/upload/${ARCHITECTURE}"
# Upload the specified.deb file
curl \
--user ${USERNAME}:${PASSWORD} \
--upload-file "${DEB_FILE}" \
${GITEA_URL}
# echo "See: automate/020_gitea_dpr.sh for sources.list creation."
# echo "deb [signed-by=\${KEYRING}] https://${USERNAME}:${PASSWORD}@https://git2.ring-zero.co.uk/api/packages/${USERNAME}/debian ${DISTRIBUTION} ${COMPONENT}"
# Show available packages
# curl -s --url https://cyteen:mlpfinsonik@git2.ring-zero.co.uk/api/v1/packages/cyteen/ | jq '.[] | select(.type == "debian") | {type, name, version, html_url, created_at}'