Git Product home page Git Product logo

grunt-heroku-deploy's Introduction

grunt-heroku-deploy

Task to switch to a deploy branch and push to heroku

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-heroku-deploy

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-heroku-deploy');

Documentation

Here's how I use this:

I do my dev on master which is set up to push to wherever I'm storing code.

git branch --set-upstream master origin/master

I set up a branch locally that will be my deploy branch - it might have some different configuration's committed. It pushes to heroku by default.

git branch --set-upstream deploy heroku/master

Now I can run grunt heroku-deploy while on the master branch, which will do:

git checkout deploy  # switch to the deploy branch
git merge master     # merge in the changes I was making
git push             # push it to heroku
git checkout master  # switch back to where I was so I can continue developing

If you want to specify the deploy branch name, use the 'deployBranch' property on each target like so:

grunt.initConfig({
	'heroku-deploy' : {
        production : {
            deployBranch : 'prod'
        },
        staging : {
            deployBranch : 'staging'
        }
    }
});

You may also provide a tag if you'd like to automatically create a new tag (and optionally push it up to origin):

grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),
  'heroku-deploy' : {
      production : {
          deployTag : 'v<%= pkg.version %>',
          pushTag : true,
          origin : 'origin'
      }
  }
})

This will create a new tag, push it to origin, and deploy that tag to heroku:

git tag v0.1.1  # create a new tag
git push origin v0.1.1 # push the tag to origin (this is skipped if pushTag is missing or false)
git push -f heroku v0.1.1^{}:master

As this is a tag, it will skip the merge step because the current changes will be present in the tag.

If you would like to specify the name of the heroku remote, you can add it to the options as herokuRemote:

grunt.initConfig({
	'heroku-deploy' : {
        production : {
            deployBranch : 'prod',
            herokuRemote : 'heroku'
        }
    }
})

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

0.1.0 - "works for me". Needs testing and feedback.

License

Copyright (c) 2012 Adam Ahmed
Licensed under the MIT license.

grunt-heroku-deploy's People

Contributors

hitsthings avatar jesseditson avatar lilyfromseattle avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.