mockband/.gitea/publish.sh

30 lines
531 B
Bash
Raw Normal View History

2024-01-04 21:36:17 -07:00
#! /bin/sh
set -e
PACKAGE=${GITHUB_REPOSITORY#*/}
VERSION=$GITHUB_REF_NAME
BASE=$GITHUB_SERVER_URL/api/packages/$GITHUB_ACTOR/generic/$PACKAGE/$VERSION
2024-01-05 09:02:53 -07:00
curl \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--request DELETE \
$BASE
2024-01-04 21:36:17 -07:00
for path in "$@"; do
fn=$(basename "$path")
echo "=== Upload $VERSION/$fn"
2024-01-04 23:12:51 -07:00
2024-01-04 23:19:10 -07:00
curl \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--request DELETE \
$BASE/$fn
2024-01-04 21:36:17 -07:00
curl \
--fail \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--upload-file "$path" \
$BASE/$fn
done