geddski / grunt-release

Release a new version of your Node-based project
MIT License
390 stars 121 forks source link

Support custom tasks #6

Closed geddski closed 9 years ago

ngryman commented 11 years ago

:+1:

btford commented 11 years ago

:+1:

eskimoblood commented 11 years ago

:+1:

brandonbloom commented 10 years ago

I could really use the ability to run some custom tasks too. Here's my use case:

I'm publishing a built subfolder, which I need to copy the package.json file in to. If I copy the file before grunt-release runs, then the version number is old. Would be great to run a copy taste between bump and publish.

ngryman commented 10 years ago

Well, this repo doesn't seem to be maintained anymore...

geddski commented 10 years ago

@ngryman you're welcome to fork or use something else.

markcellus commented 9 years ago

Yeah I would love to see some options like:

{
    preReleaseTasks: [],
    postReleaseTasks: []
}

that will be arrays of grunt tasks that you want to run before and after the release grunt task begins. I can work on adding this in in the next week or so if @geddski is okay with it.

geddski commented 9 years ago

@mkay581 totally

drublic commented 9 years ago

@mkay581 Hey, could you find the time and work on this? Would be perfect to have it in before we land a major version.

markcellus commented 9 years ago

ah my apologies. I ended up getting tied up around the time I responded to this and slipped my mind. I'll take a look later this evening after work and see if I can pull something together and open a pull

drublic commented 9 years ago

No worries. Just check back when you're done. If anyone else works on it, they will post here I guess :)

markcellus commented 9 years ago

working on it now... is there a way to denote issues that are "in progress" in your setup? To prevent others from working on the same thing?

pmb0 commented 9 years ago

Hi, there seems to be an issue with this code:

return function () {
  var method = map[taskName],
    tasks = options[method];
  if (tasks.length) {
    grunt.log.ok('running ' + method + ' ');
    if (!nowrite) {
      grunt.task.run(tasks);
    }
  }
}

It doesn't return a promise, so

.then(ifEnabled('beforeBumpTasks', runTasks('beforeBump')))
.then(ifEnabled('bump', bump))
.then(ifEnabled('afterBumpTasks', runTasks('afterBump')))
.then(ifEnabled('beforeReleaseTasks', runTasks('beforeRelease')))

doesn't work as expected. I just released a package and my afterBumpTasks finished after the release task finished:

 $ grunt release
Running "release" task
>> bumped version of bower.json to 1.7.2
>> bumped version of package.json to 1.7.2
>> running afterBumpTasks
>> staged bower.json package.json
>> Committed all files
>> created new git tag: v1.7.2
>> pushed to remote
>> pushed new tag 1.7.2 to remote
>> published version 1.7.2 to npm
>> created v1.7.2 release on github.

Running "less:dist" (less) task
File build/shariff.complete.css created
Running "browserify:dist_complete_min" (browserify) task
Running "browserify:dist_min" (browserify) task

There also seems to be an issue with the custom tasks docs:

afterBump: [], // optional grunt tasks to run after file versions are bumped`

Using afterBump doesn't work, but afterBumpTasks does.

markcellus commented 9 years ago

yeah you're right, I think there was a mixup with the documentation. i'll open a pull request with change. thanks for pointing that out @pmb0

markcellus commented 9 years ago

@pmb0 pull request created here: https://github.com/geddski/grunt-release/pull/105. Let me know if this is what you were thinking.

pmb0 commented 9 years ago

Thank you @mkay581! I think that is the fix. Looking forward to the patch. :)

drublic commented 9 years ago

This is done now, I guess.

beforeBump: [], // optional grunt tasks to run before file versions are bumped
afterBump: [], // optional grunt tasks to run after file versions are bumped
beforeRelease: [], // optional grunt tasks to run after release version is bumped up but before release is packaged
afterRelease: [], // optional grunt tasks to run after release is packaged

If there are any other issues, please open another issue :)