chore(travis): release process finalized

This commit is contained in:
Andy Joslin
2014-05-07 11:00:03 -06:00
parent 24e18e9a30
commit 07ae6dc105
4 changed files with 55 additions and 11 deletions

View File

@@ -1,9 +1,11 @@
var pkg = require('../package.json');
var fs = require('fs');
module.exports = {
dist: 'dist',
distJs: 'dist/js',
distCss: 'dist/css',
releasePostUrl: fs.readFileSync('config/RELEASE_POST_URL'),
banner:
'/*!\n' +
@@ -109,8 +111,8 @@ module.exports = {
//and can have up to a 14 char long exclamation prepended.
releaseMessage: function() {
return this.exclamations[Math.floor(Math.random()*this.exclamations.length)] + '! ' +
'Just released @IonicFramework v' + pkg.version + ' "' + pkg.codename + '"!\n' +
'Changelog at ' + pkg.repository.changelogUrl + '. Download at ' + pkg.repository.downloadUrl;
'Just released @IonicFramework v' + pkg.version + ' "' + pkg.codename + '"! ' +
this.releasePostUrl;
},
};

View File

@@ -5,9 +5,7 @@
"codename": "americium",
"changelog": "http://git.io/wliUjg",
"repository": {
"url": "git://github.com/driftyco/ionic.git",
"changelogUrl": "http://git.io/LoDTyQ",
"downloadUrl": "http://git.io/EHfQ_g"
"url": "git://github.com/driftyco/ionic.git"
},
"devDependencies": {
"karma": "~0.11.13",

View File

@@ -83,6 +83,10 @@ function run {
--action="github" \
--version=$VERSION \
--old-version=$OLD_VERSION
./scripts/travis/release-new-version.sh \
--action="discourse" \
--version=$VERSION \
--old-version=$OLD_VERSION
# Version name used on the CDN/docs: nightly or the version
VERSION_NAME=$VERSION
@@ -91,6 +95,8 @@ function run {
./scripts/site/publish.sh --action="updateConfig"
./scripts/seed/publish.sh --version="$VERSION"
./scripts/app-base/publish.sh --version="$VERSION"
gulp release-tweet release-irc
else
./scripts/site/publish.sh --action="clone"

View File

@@ -56,26 +56,26 @@ function push {
git push -q $RELEASE_REMOTE v$VERSION
echo "-- v$VERSION \"$CODENAME\" pushed to $RELEASE_REMOTE/master successfully!"
gulp release-tweet release-irc
}
function github {
echo "-- Pushing out github release..."
# Get only newest things in changelog - sed until previous version is hit
sed -e '/'"$OLD_VERSION"'/,$d' $PROJECT_DIR/CHANGELOG.md | tail -n +3 \
> $TMP_DIR/CHANGELOG_NEW.md
CODENAME=$(readJsonProp "$PROJECT_DIR/package.json" "codename")
# we have to get all releases, then find the one corresponding to this new tag
curl https://api.github.com/repos/$GH_ORG/ionic/releases > $TMP_DIR/releases.json
node -e "var releases = require('$TMP_DIR/releases.json'); \
var release; \
releases.forEach(function(r) { \
if (r.tag_name == 'v$VERSION') { \
release = r.id; \
require('fs').writeFileSync('$TMP_DIR/RELEASE_ID', r.id); \
} \
}); \
require('fs').writeFileSync('$TMP_DIR/RELEASE_ID', release);"
});"
RELEASE_ID=$(cat $TMP_DIR/RELEASE_ID)
node -e "require('fs').writeFileSync('$TMP_DIR/github.json', JSON.stringify({ \
@@ -86,10 +86,48 @@ function github {
curl -X PATCH https://api.github.com/repos/$GH_ORG/ionic/releases/$RELEASE_ID \
-H "Authorization: token $GH_TOKEN" \
--data-binary @$TMP_DIR/github.json
echo "-- Github release pushed out successfully!"
}
function discourse {
CODENAME=$(readJsonProp "$PROJECT_DIR/package.json" "codename")
# Get only newest things in changelog - sed until previous version is hit
sed -e '/'"$OLD_VERSION"'/,$d' $PROJECT_DIR/CHANGELOG.md | tail -n +3 \
> $TMP_DIR/NEW_CHANGELOG.md
node -e "var fs=require('fs'); \
fs.writeFileSync('$TMP_DIR/discourse.json', \
\"api_key=$DISCOURSE_TOKEN\" + \
\"&api_username=Ionitron\" + \
\"&title=\" + encodeURIComponent(\"v$VERSION '$CODENAME' Released!\") + \
\"&raw=\" + encodeURIComponent(\"Download Instructions: https://github.com/driftyco/ionic#quick-start\n\n\" + fs.readFileSync('$TMP_DIR/CHANGELOG_NEW.md').toString()) \
)";
curl -X POST http://forum.ionicframework.com/posts \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-binary @$TMP_DIR/discourse.json \
> $TMP_DIR/discourse-response.json
touch $IONIC_DIR/config/RELEASE_POST_URL
OLD_POST_URL=$(cat $IONIC_DIR/config/RELEASE_POST_URL)
if [[ "$OLD_POST_URL" != "" ]]; then
curl -X PUT "$OLD_POST_URL/status" --data "api_key=$DISCOURSE_TOKEN&api_username=Ionitron&status=pinned&enabled=false"
fi
POST_URL=`node -e "var res = require('$TMP_DIR/discourse-response.json'); \
console.log(\"http://forum.ionicframework.com/t/\" + res.topic_slug + \"/\" + res.topic_id);"`
echo $POST_URL > $IONIC_DIR/config/RELEASE_POST_URL
curl -X PUT "$POST_URL/status" \
--data "api_key=$DISCOURSE_TOKEN&api_username=Ionitron&status=pinned&enabled=true"
curl -X PUT "$POST_URL/status" \
--data "api_key=$DISCOURSE_TOKEN&api_username=Ionitron&status=closed&enabled=true"
cd $IONIC_DIR
git add config
git commit config -m 'chore(release): update discourse post url'
git push -q origin master
}
source $(dirname $0)/../utils.inc