chore(travis): add github releases

This commit is contained in:
Andy Joslin
2014-05-07 09:51:02 -06:00
parent 5973ded3e1
commit e381673624
2 changed files with 47 additions and 8 deletions

View File

@@ -77,8 +77,12 @@ function run {
if [[ $IS_RELEASE == "true" ]]; then
./scripts/travis/release-new-version.sh \
--codename=$CODENAME \
--action="push" \
--version=$VERSION
./scripts/travis/release-new-version.sh \
--action="github" \
--version=$VERSION \
--old-version=$OLD_VERSION
# Version name used on the CDN/docs: nightly or the version
VERSION_NAME=$VERSION

View File

@@ -1,11 +1,9 @@
#!/bin/bash
echo "##############################"
echo "# Pushing release to $RELEASE_REMOTE #"
echo "##############################"
ARG_DEFS=(
"--version=(.*)"
"[--old-version=(.*)]"
"--action=(.*)"
)
function init {
@@ -16,12 +14,18 @@ function init {
IONIC_DIR=$TMP_DIR/ionic
}
function run {
function push {
echo "##############################"
echo "# Pushing release $VERSION #"
echo "##############################"
cd ../..
rm -rf $IONIC_DIR
mkdir -p $IONIC_DIR
echo "-- Cloning ionic master ..."
git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic.git \
$IONIC_DIR \
--depth=10
@@ -30,7 +34,6 @@ function run {
# Get first codename in list
CODENAME=$(cat config/CODENAMES | head -n 1)
# Remove first line of codenames, it's used now
sed -i '' 1d config/CODENAMES
@@ -53,8 +56,40 @@ function run {
git push -q $RELEASE_REMOTE v$VERSION
echo "-- v$VERSION \"$CODENAME\" pushed to $RELEASE_REMOTE/master successfully!"
gulp release-tweet release-irc
}
function github {
# 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")
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', release);"
RELEASE_ID=$(cat $TMP_DIR/RELEASE_ID)
node -e "require('fs').writeFileSync('$TMP_DIR/github.json', JSON.stringify({ \
name: \"v$VERSION '$CODENAME'\", \
body: fs.readFileSync('$TMP_DIR/CHANGELOG_NEW.md').toString() \
}));"
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
}
function discourse {
}
source $(dirname $0)/../utils.inc