From f49b04b591c8fa53ed160ca7c8c6d950bd307bb3 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Tue, 4 Feb 2014 11:40:59 +0100 Subject: [PATCH] =pro #3689 Add script to publish samples zip files --- scripts/publish_samples.sh | 96 ++++++++++++++++++++++++++++++++++++++ scripts/release_stats.sh | 2 +- 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100755 scripts/publish_samples.sh diff --git a/scripts/publish_samples.sh b/scripts/publish_samples.sh new file mode 100755 index 0000000000..92c2d464a4 --- /dev/null +++ b/scripts/publish_samples.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash +# +# Publishes released sample zip files to Typesafe Activator. +# The zip files must have been uploaded to +# http://downloads.typesafe.com/akka/ before using this script. +# That is done by the release script. +# + +# get the source location for this script; handles symlinks +function get_script_path { + local source="${BASH_SOURCE[0]}" + while [ -h "${source}" ] ; do + source="$(readlink "${source}")"; + done + echo ${source} +} + +# path, name, and dir for this script +declare -r script_path=$(get_script_path) +declare -r script_name=$(basename "${script_path}") +declare -r script_dir="$(cd -P "$(dirname "${script_path}")" && pwd)" + +# echo a log message +function echolog { + echo "[${script_name}] $@" +} + +# echo an error message +function echoerr { + echo "[${script_name}] $@" 1>&2 +} + +# fail the script with an error message +function fail { + echoerr "$@" + exit 1 +} + +# extract uuid property from json and show url of the status page +function logStatusUrl { + local prop="uuid" + local temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop` + echolog "Check status of $name at: https://typesafe.com/activator/template/status/${temp##*|}" +} + +# print usage info +function usage { + cat < /dev/null || fail "curl command not found" + + +names=`find akka-samples -name "activator.properties" | awk -F"/" '{printf "%s\n",$2}'` + +for name in $names; do + echolog "Publishing $name" + json=$(curl --data-urlencode "url=http://downloads.typesafe.com/akka/$name-$version.zip" --user "$user:$pwd" --progress-bar https://typesafe.com/activator/template/publish) + logStatusUrl +done + + + diff --git a/scripts/release_stats.sh b/scripts/release_stats.sh index f9b9546c30..3f184d2aee 100755 --- a/scripts/release_stats.sh +++ b/scripts/release_stats.sh @@ -19,7 +19,7 @@ declare -r script_dir="$(cd -P "$(dirname "${script_path}")" && pwd)" # print usage info function usage { - echo "Usage: ${script_name} v2.1.0..v2.2.0 path_to_assembla_export.csv" + echo "Usage: ${script_name} v2.1.0 v2.2.0 path_to_assembla_export.csv" } declare -r tag1=$1