differentiate between auth user and package owner
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simon Marsh 2023-05-27 12:44:08 +01:00
parent 7386b995cd
commit 0e082a0c20
Signed by: burble
GPG Key ID: E9B4156C1659C079
2 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,7 @@ A small drone plugin to help with uploading packages to gitea.
|package|Package name|(mandatory)|
|version|Package version, may be a filename|(mandatory)|
|user|username for authentication|burble|
|owner|owner of package|burble|
|url|base URL of gitea|https://git.burble.dn42/api/packages|
|filename|filename to upload|artifact name|

View File

@ -14,6 +14,7 @@ fi
BASE_URL=${PLUGIN_URL:-https://git.burble.dn42/api/packages}
USER=${PLUGIN_USER:-burble}
OWNER=${PLUGIN_OWNER:-burble}
FILENAME=${PLUGIN_FILENAME:-$PLUGIN_ARTIFACT}
# version or token could be a filename
@ -36,7 +37,7 @@ TOKEN=$(maybe_from_file "$PLUGIN_TOKEN")
# finally do the curl thing to upload the artifact
url=$(printf '%s/%s/generic/%s/%s/%s' \
"$BASE_URL" "$USER" "$PLUGIN_PACKAGE" \
"$BASE_URL" "$OWNER" "$PLUGIN_PACKAGE" \
"$VERSION" "$PLUGIN_ARTIFACT")
curl --user "${USER}:${TOKEN}" --upload-file="$FILENAME" "$url"