mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
53 lines
1.6 KiB
Bash
Executable File
53 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# Source logging utilities
|
|
source ../formatters/logging/logging.sh
|
|
|
|
if [ -z "$GITHUB_REF" ]; then
|
|
BRANCH=$(git symbolic-ref --short -q HEAD)
|
|
else
|
|
BRANCH=${GITHUB_REF#refs/heads/}
|
|
fi
|
|
|
|
# Get the latest commit message
|
|
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
|
|
log_title "Spine-Haxe Build"
|
|
log_detail "Branch: $BRANCH"
|
|
|
|
# Public only if the commit message is in the correct format
|
|
if echo "$COMMIT_MSG" | grep -qE '^\[haxe\] Release [0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
VERSION=$(echo "$COMMIT_MSG" | sed -E 's/^\[haxe\] Release ([0-9]+\.[0-9]+\.[0-9]+)$/\1/')
|
|
log_detail "Version: $VERSION"
|
|
|
|
if [ ! -z "$HAXE_UPDATE_URL" ] && [ ! -z "$BRANCH" ]; then
|
|
log_section "Deploy"
|
|
log_action "Creating release package"
|
|
zip -r "spine-haxe-$VERSION.zip" \
|
|
haxelib.json \
|
|
LICENSE \
|
|
README.md \
|
|
spine-haxe > /dev/null 2>&1
|
|
log_ok "Package created"
|
|
|
|
log_action "Uploading to $HAXE_UPDATE_URL$BRANCH"
|
|
if curl -f -F "file=@spine-haxe-$VERSION.zip" "$HAXE_UPDATE_URL$BRANCH" > /dev/null 2>&1; then
|
|
log_ok "Package deployed"
|
|
else
|
|
log_fail "Upload failed"
|
|
exit 1
|
|
fi
|
|
|
|
log_summary "✓ Build and deployment successful"
|
|
else
|
|
log_skip "Deployment skipped (HAXE_UPDATE_URL and/or BRANCH not set)"
|
|
log_summary "✓ Build successful"
|
|
fi
|
|
else
|
|
log_warn "Commit is not a release - skipping publish"
|
|
log_detail "To release, commit message must be: \"[haxe] Release x.y.z\""
|
|
log_summary "Build skipped"
|
|
fi |