Skip to content

Instantly share code, notes, and snippets.

@kmanna
Last active December 26, 2015 09:09
Show Gist options
  • Save kmanna/7127085 to your computer and use it in GitHub Desktop.
Save kmanna/7127085 to your computer and use it in GitHub Desktop.
Example Ivy promotion script to promote milestones to release builds without using Ant.
#!/bin/sh
#
# Example Ivy promotion script to promote milestones to release builds
#
ORG="$1"
MOD="$2"
OUT="./promote"
REV="latest.milestone"
IVY="~/.ant/lib/ivy-2.3.0.jar"
set -ex
rm -rf $OUT
# Fetch the last milestone
java -jar $IVY \
-settings "$WS/common/ivysettings.xml" \
-dependency "$ORG" "$MOD" "$REV" \
-notransitive \
-retrieve "$OUT/[revision]/[artifact].[ext]" \
-ivypattern "$OUT/[revision]/[artifact].[ext]"
# What did we download?
MILESTONE=$(basename $(ls -d $OUT/*))
# Prune the "-milestone" out of the version tag
RELEASE="${MILESTONE%-milestone}"
# Publish it back!
java -jar $IVY \
-settings "$WS/common/ivysettings.xml" \
-ivy "$OUT/$MILESTONE/ivy.xml" \
-publish "local" \
-publishpattern "$OUT/$MILESTONE/[artifact].[ext]" \
-revision "$RELEASE" \
-status "release"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment