um-react/scripts/publish.sh
Jixun Wu c579fb1928
All checks were successful
continuous-integration/drone Build is passing
ci: get started on ci build
2023-06-09 01:01:41 +01:00

22 lines
613 B
Bash
Executable File

#!/bin/bash -ex
BRANCH_NAME="$(git branch --show-current)"
publish_gitea() {
local ZIP_NAME="$1"
local URL="${DRONE_GITEA_SERVER}/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}/${DRONE_BUILD_NUMBER}/${ZIP_NAME}"
sha256sum "${ZIP_NAME}"
curl -sLifu "um-release-bot:${GITEA_API_KEY}" -T "${ZIP_NAME}" "${URL}"
echo "Uploaded to: ${URL}"
}
# Only publish main branch by default
if [[ "${BRANCH_NAME}" = "main" ]]; then
echo 'prepare to publish...'
if [[ -n "${GITEA_API_KEY}" ]]; then
echo "Publish to gitea..."
publish_gitea "um-react.zip"
fi
fi