-
Notifications
You must be signed in to change notification settings - Fork 796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect if release is necessary, exit if not #192
Comments
@enriquecaballero sounds like good idea, i like it too. Btw are you saying that you integrated the |
I just tested this, and confirmed that |
tldr |
@stevemao I could see an argument for having a @enriquecaballero what do you think? (also sorry for this incredibly slow reply). |
Sounds good. |
Is this going to be a feature in the future? This is handy for CI especially when your CI pushes tags and commits back to Git. This will cause an endless cycle as each push will trigger a new version that's going to push a new change log again and so on. |
Jumping in on this, it'd be really nice if standard-version supported this. In the meantime, if you're stuck on this, I wrote/use a small naive bash script to perform this type of check on CircleCI: #!/bin/bash
set -e
{
git describe --tags --exact-match > /dev/null 2>&1 && {
echo "Release is already associated to a tag. Skipping..."
exit 0
}
} || {
echo "Running new release"
npm run release && {
git push origin $CIRCLE_BRANCH && git push origin --tags
} || {
echo "Release aborted as branch was updated during build."
}
}
exit 0 Where should be easily portable to other CI providers (only specific part is |
I'm going to take a look into getting this done this week 👍 |
In case it helps someone, here's what I have in my CI script. In commits since the previous tag, it'll proceed if any commit subject matches if \
{ git log "$( git describe --tags --abbrev=0 )..HEAD" --format='%s' | cut -d: -f1 | sort -u | sed -e 's/([^)]*)//' | grep -q -i -E '^feat|fix|perf|refactor|revert$' ; } || \
{ git log "$( git describe --tags --abbrev=0 )..HEAD" --format='%s' | cut -d: -f1 | sort -u | sed -e 's/([^)]*)//' | grep -q -E '\!$' ; } || \
{ git log "$( git describe --tags --abbrev=0 )..HEAD" --format='%b' | grep -q -E '^BREAKING CHANGE:' ; }
then
npx --quiet standard-version@7.1.0
else
echo "No applicable changes since the previous tag, skipping..."
fi |
+1 |
Here's a proposal for a possible solution that wouldn't involve file blacklists etc: Use PresetsThis might actually solve two issues with
In both cases, the solution seems to be to make One way this could be achieved while not imposing any particular, strict process on users is via presets. At the moment, presets are used primarily to translate various commit types into the headings they will appear under in a project's The definition for the
And a typical value for "types": [
{"type": "feat", "section": "Features"},
{"type": "fix", "section": "Bug Fixes"},
{"type": "chore", "hidden": true},
{"type": "docs", "hidden": true},
{"type": "style", "hidden": true},
{"type": "refactor", "hidden": true},
{"type": "perf", "hidden": true},
{"type": "test", "hidden": true}
] So, what if It already does something like this when determining what type of release to create, the difference I'm proposing is that if it finds (1) no commits at all or (2) no commits that match one of the "explicitly supported commit message types", it exits without creating a release. This proposal still maintains the usefulness of the Omitting a commit type from This would also allow users to continue following the same commit message format (conventional, for example) and run tools like commitlint, they would just need to decide on one or more commit types to use for commits that should not trigger a release. Working within the current implementation of the default preset, a commit type like Addendum:
|
semantic-release
has a sweet way of detecting whether or not it should follow through with a release. Some commits are just docs, style, and even refactor, that don't really affect the published build, hence a release shouldn't really take place. Currently,standard-version
tags the release regardless of what the commits are -- for commits that don't affect the build,standard-version
bumps the version number as a patch. We usestandard-version
at work for our CI builds and it works great for publishing to our internal registry, but it overpopulates our registry with unnecessary releases. The same with Bitbucket and unnecessary release tags.Is this a viable feature that can be implemented into
standard-version
? Or is always releasing the correct behavior and should always be expected?The text was updated successfully, but these errors were encountered: