c9-core/node_modules/ace/tool/release.sh

120 wiersze
3.0 KiB
Bash
Czysty Zwykły widok Historia

2016-06-26 11:53:19 +00:00
#!/bin/bash
2017-07-04 19:40:11 +00:00
set -e
2016-06-26 11:53:19 +00:00
pause() {
while true; do
read -p "$1 " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
}
cd `dirname $0`/..
SOURCE=`pwd`
2017-07-04 19:40:11 +00:00
# check if build dir is clean
if ! [ -f build/.git/HEAD ]; then
git clone git@github.com:ajaxorg/ace-builds.git build
fi
pushd build
git fetch
if [ "$(git rev-parse --revs-only HEAD)" != "$(git rev-parse --revs-only refs/remotes/origin/master)" ]; then
echo build directory not clean;
exit 1
fi
if [ "$(git ls-files --others --exclude-standard)" ];
then echo untracked files;
git ls-files --others --exclude-standard
exit 1
fi
popd
# clean untracked files from modes and themes
while read line; do
if [ -f "$line" ]; then
mkdir -p "_$(dirname "$line")";
echo "$line";
mv "$line" "_$line";
fi
done <<< "$(git ls-files --others --exclude-standard lib/ace)"
# show history
git checkout refs/remotes/origin/master -- package.json
2016-06-26 11:53:19 +00:00
CUR_VERSION=`node -e 'console.log(require("./package.json").version)'`
2017-07-04 19:40:11 +00:00
git --no-pager log --color --first-parent --oneline v$CUR_VERSION..master |
sed -e s"/^/https:\/\/github.com\/ajaxorg\/ace\/commit\//"
2016-06-26 11:53:19 +00:00
echo "current version is $CUR_VERSION"
2017-07-04 19:40:11 +00:00
# get new version number
VERSION_NUM=;
until [[ "$VERSION_NUM" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] ; do
read -p "enter version number for the build " VERSION_NUM
done
# update version number everywhere
2016-06-26 11:53:19 +00:00
node -e "
var fs = require('fs');
var version = '$VERSION_NUM';
function replaceVersion(str) {
return str.replace(/(['\"]?version['\"]?\s*[:=]\s*['\"])[\\d.\\w\\-]+(['\"])/, function(_, m1, m2) {
return m1 + version + m2;
});
}
function update(path, replace) {
var pkg = fs.readFileSync(path, 'utf8');
pkg = (replace || replaceVersion)(pkg);
fs.writeFileSync(path, pkg, 'utf8');
}
update('package.json');
update('build/package.json');
2017-07-04 19:40:11 +00:00
update('./lib/ace/ace.js');
2016-06-26 11:53:19 +00:00
update('ChangeLog.txt', function(str) {
var date='"`date +%Y.%m.%d`"';
return date + ' Version ' + version + '\n' + str.replace(/^\d+.*/, '').replace(/^\n/, '');
});
"
pause "versions updated. do you want to start build script? [y/n]"
node Makefile.dryice.js full
cd build
git add .
git commit --all -m "package `date +%d.%m.%y`"
echo "build task completed."
pause "continue creating the tag for v$VERSION_NUM [y/n]"
if [[ ${VERSION_NUM} != *"-"* ]]; then
git tag "v"$VERSION_NUM
fi
pause "continue pushing to github? [y/n]"
git push --progress --tags "origin" HEAD:gh-pages HEAD:master
echo "build repository updated"
pause "continue update ace repo? [y/n]"
cd ..
2017-07-04 19:40:11 +00:00
git commit -a -m "release v$VERSION_NUM"
2016-06-26 11:53:19 +00:00
echo "new commit added"
pause "continue creating the tag for v$VERSION_NUM [y/n]"
if [[ ${VERSION_NUM} != *"-"* ]]; then
git tag "v"$VERSION_NUM
fi
pause "continue pushing to github? [y/n]"
git push --progress --tags "origin" HEAD:gh-pages HEAD:master
echo "All done!"
pause "May I go now? [y/n]"