conventional-changelog / standard-version

:trophy: Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to add other artifacts to the release commit

JaKXz opened this issue · comments

ATM, I'm amending because I want the produced artifacts to be part of the chore(release): x.x.x commit.

"prerelease": "webpack -p --bail", //produces some bundle artifacts that I want to commit
"release": "standard-version -s",
"postrelease": "git commit -a --amend --no-edit"

However, because of the way git works this creates a new commit object since the original commit is tagged before the amend happens. What would be nice is if my postrelease script was really a poststandard-version script (i.e. a "lifecycle-style" hook like the npm run script itself).

cc @stevemao @bcoe

Been looking at using standard-version for videojs. We basically do this for pre-build bundles for bower users or other users who don't want to use a bundler.
A potentially easy change is to be able to run the tagging portion of standard-version separately. So, you run the changelog generator, it doesn't commit or tag yet, then, you run your build script and then run the commit/tagging portion.
Or you could accept a command to run before committing. Kind of like you can do an npm version script that builds a release and adds the changes to git.

@bcoe @stevemao thanks for v3.0! :) do you guys have any thoughts on this though?

@JaKXz I'm not opposed to this idea, would love to make sure we support a few common workflows; is there an approach that you think would work well for both your and @gkatsev's use-case?

@bcoe @gkatsev @JaKXz Is there still a need for a hook between git add and git commit/tag? Does v3.0 and --commit-all not enable this, since artifacts built before the release script will be added to the commit?

"prerelease": "webpack -p --bail",
"release": "standard-version --commit-all" // Could replace --commit-all with -a

I'm not against supporting a "lifecycle-hook" between the add and commit/tag (e.g. standard-version-pre-commit or something less verbose) but at least this use-case seems to be covered.

I think that --commit-all could potentially work for my usecase. It seems similar to what I've done with the built-in version script:

"version": "npm run build && git add -f dist/"

Then when npm's versioning runs, it just commits the entire thing.

Great! I think this issue can technically be closed, since you can commit any artifacts built before standard-version with --commit-all. Just gonna wait for @JaKXz to confirm that this works for him as well.

Actually we should keep this issue open to track documentation relating to this use-case.

@Tapppi --commit-all works! Thanks so much :D

...actually, I may have spoken too soon. I had to add the built assets to the release commit myself.

Based on #121 it looks like I have to git add . before standard-version -as.

Yes - documentation on this would be great: I can try to write something up tonight but can't promise free time so if someone else can do it please do #127.

Yes, currently the commit-all flag just commits already staged changes. That might seem confusing, but I actually think it allows for greater control over the process. Needs to be clear in the documentation though. I'll take a look at the pr soon when I'm on my comp.