mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[haxe] Publish script. Pipeline reacts only to version commits.
This commit is contained in:
parent
80a0bbed5d
commit
197cfc3efd
@ -1,24 +1,32 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -z "$GITHUB_REF" ];
|
if [ -z "$GITHUB_REF" ]; then
|
||||||
then
|
BRANCH=$(git symbolic-ref --short -q HEAD)
|
||||||
BRANCH=$(git symbolic-ref --short -q HEAD)
|
|
||||||
else
|
else
|
||||||
BRANCH=${GITHUB_REF#refs/heads/}
|
BRANCH=${GITHUB_REF#refs/heads/}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Building spine-haxe $BRANCH artifacts"
|
# Get the latest commit message
|
||||||
|
COMMIT_MSG=$(git log -1 --pretty=%B)
|
||||||
|
|
||||||
if ! [ -z "$HAXE_UPDATE_URL" ] && ! [ -z "$BRANCH" ];
|
# Public only if the commit message is in the correct format
|
||||||
then
|
if echo "$COMMIT_MSG" | grep -qE '^\[haxe\] Release [0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||||
echo "Deploying spine-haxe $BRANCH artifacts"
|
VERSION=$(echo "$COMMIT_MSG" | sed -E 's/^\[haxe\] Release ([0-9]+\.[0-9]+\.[0-9]+)$/\1/')
|
||||||
zip -r spine-haxe.zip \
|
echo "Building spine-haxe $BRANCH artifacts (version $VERSION)"
|
||||||
haxelib.json \
|
|
||||||
LICENSE \
|
if [ ! -z "$HAXE_UPDATE_URL" ] && [ ! -z "$BRANCH" ]; then
|
||||||
README.md \
|
echo "Deploying spine-haxe $BRANCH artifacts (version $VERSION)"
|
||||||
spine-haxe
|
zip -r "spine-haxe-$VERSION.zip" \
|
||||||
curl -f -F "file=@spine-haxe.zip" "$HAXE_UPDATE_URL$BRANCH"
|
haxelib.json \
|
||||||
|
LICENSE \
|
||||||
|
README.md \
|
||||||
|
spine-haxe
|
||||||
|
curl -f -F "file=@spine-haxe-$VERSION.zip" "$HAXE_UPDATE_URL$BRANCH"
|
||||||
|
else
|
||||||
|
echo "Not deploying artifacts. HAXE_UPDATE_URL and/or BRANCH not set."
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Not deploying artifacts. HAXE_UPDATE_URL and/or BRANCH not set."
|
echo "The commit is not a release - do not publish."
|
||||||
|
echo "To release the commit has to be in the for: \"[haxe] Release x.y.z\""
|
||||||
fi
|
fi
|
||||||
@ -18,7 +18,7 @@
|
|||||||
],
|
],
|
||||||
"description": "The official Spine Runtime for Haxe",
|
"description": "The official Spine Runtime for Haxe",
|
||||||
"version": "4.2.0",
|
"version": "4.2.0",
|
||||||
"releasenote": "Initial release",
|
"releasenote": "Update to 4.2.0",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"esotericsoftware"
|
"esotericsoftware"
|
||||||
],
|
],
|
||||||
|
|||||||
29
spine-haxe/publish.sh
Executable file
29
spine-haxe/publish.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
currentVersion=$(grep -o '"version": "[^"]*' haxelib.json | grep -o '[^"]*$')
|
||||||
|
|
||||||
|
major=$(echo "$currentVersion" | cut -d. -f1)
|
||||||
|
minor=$(echo "$currentVersion" | cut -d. -f2)
|
||||||
|
patch=$(echo "$currentVersion" | cut -d. -f3)
|
||||||
|
newPatch=$((patch + 1))
|
||||||
|
newVersion="$major.$minor.$newPatch"
|
||||||
|
|
||||||
|
echo "current version: $currentVersion"
|
||||||
|
echo "new version: $newVersion"
|
||||||
|
|
||||||
|
sed -i '' "s/$currentVersion/$newVersion/" haxelib.json
|
||||||
|
|
||||||
|
echo "Write Y if you want to commit and push the new version $newVersion."
|
||||||
|
echo "This will trigger a pipeline that will publish the new version on esoteric software server."
|
||||||
|
echo "Do you want to proceed [y/n]?"
|
||||||
|
|
||||||
|
read answer
|
||||||
|
if [ "$answer" = "Y" ] || [ "$answer" = "y" ]; then
|
||||||
|
git add haxelib.json
|
||||||
|
git commit -m "[haxe] Release $newVersion"
|
||||||
|
git push origin haxe-ci
|
||||||
|
echo "Changes committed and pushed."
|
||||||
|
else
|
||||||
|
echo "Commit and push cancelled, but haxelib.json version updated."
|
||||||
|
fi
|
||||||
Loading…
x
Reference in New Issue
Block a user