mockband/.gitea/publish.sh

27 lines
510 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
echo "=== Delete existing version: $VERSION"
curl \
--include \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--request DELETE \
$BASE
for path in "$@"; do
fn=$(basename "$path")
echo "=== Upload $VERSION/$fn"
curl \
--fail \
--include \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--upload-file "$path" \
$BASE/$fn
done