Skip to content

Commit

Permalink
Merge pull request #2284 from harvesthq/bower-release-from-travis
Browse files Browse the repository at this point in the history
Let Travis publish bower-chosen
  • Loading branch information
pfiller committed Mar 28, 2015
2 parents f091620 + 35d5592 commit cb6b033
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
.project
public/*.js
public/*.css
public/bower.json
chosen.zip
.sass-cache
.ruby-version
Expand Down
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ node_js:
- "0.10"

before_install:
- npm install -g grunt-cli
- gem install compass
- npm install -g grunt-cli
- gem install compass
before_script: grunt build

after_success: ./bower-publish.sh

env:
global:
secure: WbrrS9cR3vpRXtPp/YdtsKZHwWkTDBaqPdXh6+rasQf1pvKfjPaL1bVFDomxsppIa6RjVJyTxJDU4sYnsemop/0vlSs+YuF1e+iPXfzc/javpvk9CIelrXrktehCXxVEZqkTKIAd6OGo668pfov24F5RmaSCr5hQLd6buNIVApo=
13 changes: 3 additions & 10 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,13 @@ This file is generated by `grunt build`, do not edit it by hand.
options:
base: 'public',
message: "Updated to new Chosen version #{version()}"
'gh-pages':
src: ['**']
'bower':
options:
repo: 'https://github.com/harvesthq/bower-chosen'
tag: version_tag()
src: ['bower.json', 'chosen.jquery.min.js', 'chosen.min.css', 'chosen-sprite.png', 'chosen-sprite@2x.png']
src: ['**']

grunt.registerTask 'default', ['build']
grunt.registerTask 'build', ['coffee', 'compass', 'concat', 'uglify', 'cssmin']
grunt.registerTask 'build', ['coffee', 'compass', 'concat', 'uglify', 'cssmin', 'package-bower']
grunt.registerTask 'prep-release', ['build', 'dom_munger:latest_version', 'zip:chosen','package-jquery']

grunt.registerTask 'publish-bower', ['package-bower', 'gh-pages:bower', 'cleanup-bower']
grunt.registerTask 'publish-release', ['gh-pages:gh-pages','publish-bower']
grunt.registerTask 'publish-release', ['gh-pages']

grunt.registerTask 'package-jquery', 'Generate a jquery.json manifest file from package.json', () ->
src = "package.json"
Expand Down
31 changes: 31 additions & 0 deletions bower-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`

if [ $CURRENT_BRANCH != 'master' ] ; then
echo "Build not on master. Skipped bower-chosen release"
exit 0
fi

git clone https://pfiller:${GH_TOKEN}@github.com/harvesthq/bower-chosen.git
rm -rf bower-chosen/*
cp public/bower.json public/*.png public/chosen.jquery.min.js public/chosen.min.css bower-chosen/
cd bower-chosen


LATEST_VERSION=$(git diff bower.json | grep version | cut -d':' -f2 | cut -d'"' -f2 | tail -1)

if [ -z $LATEST_VERSION ] ; then
echo "No Chosen version change. Skipped tagging"
else
echo "Chosen version changed. Tagging version ${LATEST_VERSION}\n"
git tag -a "v${LATEST_VERSION}" -m "Version ${LATEST_VERSION}"
fi

git remote set-url origin https://pfiller:${GH_TOKEN}@github.com/harvesthq/bower-chosen.git
git add -A
git commit -m "Chosen build to bower-chosen"
git push origin master
git push origin --tags

echo "Chosen published to harvesthq/bower-chosen"

0 comments on commit cb6b033

Please sign in to comment.