um-react/scripts/publish.sh
Jixun Wu b66eea4069
All checks were successful
continuous-integration/drone/push Build is passing
ci: hide verbose logging from publish/deploy
2023-06-09 01:10:37 +01:00

22 lines
612 B
Bash
Executable File

#!/bin/bash -e
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