shipshapecode / ember-cli-release

Ember CLI addon for versioned release management
MIT License
90 stars 18 forks source link

Publish example does not work #25

Closed elwayman02 closed 9 years ago

elwayman02 commented 9 years ago

I tried the following config:

/* jshint node:true */
var RSVP = require('rsvp');
var publisher = require('publish');

// Create promise friendly versions of the methods we want to use
var start = RSVP.denodeify(publisher.start);
var publish = RSVP.denodeify(publisher.publish);

module.exports = {
  manifest: ['package.json'],

  // Publish the new release to NPM after a successful push
  // If run from travis, this will look for the NPM_USERNAME, NPM_PASSWORD and
  // NPM_EMAIL environment variables to publish the package as
  afterPush: function() {
    return start().then(function() {
      return publish({});
    });
  }
};

...with publish added as an npm devDependency for the project.

Unfortunately, it does not seem to get triggered, and I've had to publish manually.

slindberg commented 9 years ago
rwjblue commented 9 years ago

I know it is cheating, but assuming you run Node 0.12+ or iojs you can just use execSync and call npm publish.

I use the following in quite a few projects:

var execSync = require('child_process').execSync;

module.exports = {
  // Publish the new release to NPM after a successful push
  afterPush: function() {
    console.log('publishing to npm');
    var output = execSync('npm publish', { encoding: 'utf8' });
    console.log(output);
  }
};
elwayman02 commented 9 years ago

@slindberg I'm using ember-cli-release 0.2.3, which is what got automatically installed thanks to the addon blueprint :(

All the more reason for https://github.com/ember-cli/ember-cli/pull/4891, I suppose.