robwierzbowski / grunt-build-control

Version control your built code.
MIT License
379 stars 36 forks source link

multiple remotes #58

Closed percy3d closed 9 years ago

percy3d commented 9 years ago

Hi,

I have multiple remote servers I would need to deploy to. Is there a way to configure buildcontrol to handle more than one remote?

kevinawoo commented 9 years ago

It's possible to have as many as you'd like, you can set different scopes.

    // global options for grunt-build-control
    options: {
        dir: 'dist',
        commit: true,
        push: true,
        message: 'This commit message is for all environments below'
    },

    // deployment environments
    stage: {
        options: {
            remote: 'git@heroku.com:stage.git',
            branch: 'master'
        }
    },

    // production environment
    production: {
        options: {
            remote: 'git@heroku.com:production.git',
            branch: 'master',
            tag: 'v' + pkg.version
        }
    }

and to deploy to each one grunt build-control:stage or grunt build-control:production

percy3d commented 9 years ago

ah yes, so define different envs and stack them in the grunt task...gotcha!

nmalacarne commented 8 years ago

Hi,

I get the following after running one env task after the other:

Warning: To ssh://user@remote:repo.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'ssh://user@remote:repo.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
 Used --force, continuing.
Warning: Task "buildcontrol:pre" failed. Used --force, continuing.

Here are my tasks:

module.exports = {
  options: {
    dir: 'dist',
    commit: true,
    push: true,
    message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
  },
  pre: {
    options: {
      remote: process.env.PRE_GIT_URL,
      branch: 'master'
    }
  },
  prod: {
    options: {
      remote: process.env.PROD_GIT_URL,
      branch: 'master'
    }
  }
};

If I delete the dist/ folder before each task, they deploy fine. Any ideas?

kevinawoo commented 8 years ago

Sounds like there's some merge conflicts in dist/. Try these steps:

The next time you run it, it should be work with no problems. You might have to do the same steps with both environments.