2022-11-26 23:52:48 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
|
2022-11-27 00:43:37 +00:00
|
|
|
if [ -z "$GITEA_API_KEY" ]; then
|
|
|
|
echo "GITEA_API_KEY is empty, skip upload."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2022-11-26 23:52:48 +00:00
|
|
|
URL_BASE="$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build"
|
|
|
|
|
|
|
|
for ZIP_NAME in *.zip; do
|
2022-11-27 00:43:37 +00:00
|
|
|
UPLOAD_URL="${URL_BASE}/${DRONE_BUILD_NUMBER}/${ZIP_NAME}"
|
|
|
|
sha256sum "${ZIP_NAME}"
|
|
|
|
curl -sLifu "um-release-bot:$GITEA_API_KEY" -T "${ZIP_NAME}" "${UPLOAD_URL}"
|
|
|
|
echo "Uploaded to: ${UPLOAD_URL}"
|
2022-11-26 23:52:48 +00:00
|
|
|
done
|