automate/gitea-scripts/delete-deb-from-gitea.sh

34 lines
931 B
Bash
Executable File

#!/usr/bin/env bash
USERNAME="cyteen"
PASSWORD="mlpfinsonik"
RELEASE="ceres"
COMPONENT="main"
ARCH=$(dpkg --print-architecture)
# Check if both package name and version were provided as arguments
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 <package_name> <version>"
exit 1
fi
PACKAGE="$1"
VERSION="$2"
echo "PACKAGE: ${PACKAGE}"
echo "VERSION: ${VERSION}"
# Construct the URL for the specified package and version
GITEA_URL="https://git2.ring-zero.co.uk/api/v1/packages/${USERNAME}/debian/${PACKAGE}/${VERSION}"
echo ${GITEA_URL}
# Use the constructed URL in the curl command to delete the specified package version
curl --user ${USERNAME}:${PASSWORD} \
-X DELETE \
-H 'accept: application/json' \
"${GITEA_URL}"
# 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}'