1
0
mirror of synced 2024-11-25 06:16:08 +03:00
select2/release.sh

80 lines
1.5 KiB
Bash
Raw Normal View History

2012-05-16 20:35:21 +04:00
#!/bin/bash
set -e
echo -n "Enter the version for this release: "
read ver
2014-01-12 20:17:47 +04:00
if [ ! $ver ]; then
2012-05-16 20:35:21 +04:00
echo "Invalid version."
exit
fi
name="select2"
2012-05-16 20:35:21 +04:00
js="$name.js"
mini="$name.min.js"
css="$name.css"
release="$name-$ver"
2013-02-06 06:33:42 +04:00
tag="$ver"
2012-05-16 20:35:21 +04:00
branch="build-$ver"
curbranch=`git branch | grep "*" | sed "s/* //"`
timestamp=$(date)
tokens="s/@@ver@@/$ver/g;s/\@@timestamp@@/$timestamp/g"
remote="origin"
2012-05-16 20:35:21 +04:00
2013-11-04 20:22:33 +04:00
echo "Pulling from origin"
git pull
2013-02-06 06:33:42 +04:00
echo "Updating Version Identifiers"
sed -E -e "s/\"version\": \"([0-9\.]+)\",/\"version\": \"$ver\",/g" -i -- bower.json select2.jquery.json component.json composer.json package.json
2013-08-13 02:03:50 +04:00
git add bower.json
2013-02-06 06:33:42 +04:00
git add select2.jquery.json
2013-12-07 23:28:31 +04:00
git add component.json
git add composer.json
2014-01-12 20:17:47 +04:00
git add package.json
2013-02-06 06:33:42 +04:00
git commit -m "modified version identifiers in descriptors for release $ver"
git push
2012-05-16 20:35:21 +04:00
git branch "$branch"
git checkout "$branch"
echo "Tokenizing..."
find . -name "$js" | xargs -I{} sed -e "$tokens" -i -- {}
find . -name "$css" | xargs -I{} sed -e "$tokens" -i -- {}
sed -e "s/latest/$ver/g" -i -- bower.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 \
--data-urlencode "js_code@$js" \
http://marijnhaverbeke.nl/uglifyjs \
2012-05-16 20:35:21 +04:00
>> "$mini"
git add "$mini"
2012-05-16 20:35:21 +04:00
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"
echo "Done"