2012-05-16 20:35:21 +04:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo -n "Enter the version for this release: "
|
|
|
|
|
|
|
|
read ver
|
|
|
|
|
|
|
|
if [ ! $ver ]; then
|
|
|
|
echo "Invalid version."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2012-08-14 20:02:25 +04:00
|
|
|
name="select2"
|
2012-05-16 20:35:21 +04:00
|
|
|
js="$name.js"
|
|
|
|
mini="$name.min.js"
|
|
|
|
css="$name.css"
|
|
|
|
release="$name-$ver"
|
|
|
|
tag="release-$ver"
|
|
|
|
branch="build-$ver"
|
|
|
|
curbranch=`git branch | grep "*" | sed "s/* //"`
|
|
|
|
timestamp=$(date)
|
|
|
|
tokens="s/@@ver@@/$ver/g;s/\@@timestamp@@/$timestamp/g"
|
|
|
|
remote="github"
|
|
|
|
|
|
|
|
git branch "$branch"
|
|
|
|
git checkout "$branch"
|
|
|
|
|
|
|
|
echo "Tokenizing..."
|
|
|
|
|
2012-09-10 21:36:37 +04:00
|
|
|
find . -name "$js" | xargs -I{} sed -e "$tokens" -i "" {}
|
|
|
|
find . -name "$css" | xargs -I{} sed -e "$tokens" -i "" {}
|
2012-09-18 06:10:00 +04:00
|
|
|
sed -e "s/latest/$ver/g" -i "" component.json
|
2012-05-16 20:35:21 +04:00
|
|
|
|
|
|
|
git add "$js"
|
|
|
|
git add "$css"
|
|
|
|
|
|
|
|
echo "Minifying..."
|
|
|
|
|
|
|
|
echo "/*" > "$mini"
|
|
|
|
cat LICENSE | sed "$tokens" >> "$mini"
|
|
|
|
echo "*/" >> "$mini"
|
|
|
|
|
|
|
|
curl -s \
|
|
|
|
-d compilation_level=SIMPLE_OPTIMIZATIONS \
|
|
|
|
-d output_format=text \
|
|
|
|
-d output_info=compiled_code \
|
|
|
|
--data-urlencode "js_code@$js" \
|
|
|
|
http://closure-compiler.appspot.com/compile \
|
|
|
|
>> "$mini"
|
|
|
|
|
|
|
|
git add "$mini"
|
|
|
|
|
|
|
|
git commit -m "release $ver"
|
|
|
|
|
|
|
|
echo "Tagging..."
|
|
|
|
git tag -a "$tag" -m "tagged version $ver"
|
|
|
|
git push "$remote" --tags
|
|
|
|
|
|
|
|
echo "Cleaning Up..."
|
|
|
|
|
|
|
|
git checkout "$curbranch"
|
|
|
|
git branch -D "$branch"
|
|
|
|
|
2012-09-10 21:36:37 +04:00
|
|
|
echo "Done"
|