mockband/.gitea/publish.sh

30 lines
531 B
Bash
Executable File

#! /bin/sh
set -e
PACKAGE=${GITHUB_REPOSITORY#*/}
VERSION=$GITHUB_REF_NAME
BASE=$GITHUB_SERVER_URL/api/packages/$GITHUB_ACTOR/generic/$PACKAGE/$VERSION
curl \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--request DELETE \
$BASE
for path in "$@"; do
fn=$(basename "$path")
echo "=== Upload $VERSION/$fn"
curl \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--request DELETE \
$BASE/$fn
curl \
--fail \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--upload-file "$path" \
$BASE/$fn
done