Skip to content
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

fix: release to npm after user defined plugins #105

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

Balvajs
Copy link
Contributor

@Balvajs Balvajs commented Mar 19, 2024

When @semantic-release/npm is used, updated CHANGELOG.md is not in the new version release. It's caused by nx build running before semantic-release plugins, and the dist/{project}/CHANGELOG.md don't get updated.

This could be fixed by users of nx-semantic-release by setting .nxreleaserc.json:

{
	"plugins": [
		[
			"@semantic-release/changelog",
			{
				"changelogFile": "${WORKSPACE_DIR}/dist/${RELATIVE_PROJECT_DIR}/CHANGELOG.md"
			}
		]
	]
}

However, because the @semantic-release/npm runs before user-defined plugins, it's not possible.

So this PR changes that order of @semantic-release/npm and it's putting it before @semantic-release/git together with @semantic-release/github, which seems a more consistent setup anyway.

@semantic-release/npm has to stay before @semantic-release/git, because otherwise the changes to package.json aren't committed.

I am not sure how to do it, but some solution that wouldn't require users to define additional @semantic-release/changelog in the config would be definitely nicer.

With `@semantic-release/npm` being used before `@semantic-release/git` the NPM release doesn't contain updated `CHANGELOG.md` and `package.json`.
And that can be very confusing for the consumers of the package.

Simply changing the order of plugins should fix that. GitHub plugin already is in that order, so it will be consistent.
@Balvajs Balvajs marked this pull request as ready for review March 19, 2024 09:46
@Balvajs Balvajs requested a review from TheUnderScorer as a code owner March 19, 2024 09:46
@Balvajs Balvajs changed the title feat: release to npm after creating git commit fix: release to npm after creating git commit Mar 22, 2024
@Balvajs Balvajs changed the title fix: release to npm after creating git commit WIP fix: release to npm after creating git commit Mar 22, 2024
@Balvajs Balvajs changed the title WIP fix: release to npm after creating git commit fix: release to npm after creating git commit Mar 22, 2024
@Balvajs Balvajs changed the title fix: release to npm after creating git commit fix: release to npm after user defined plugins Apr 9, 2024
@TheUnderScorer TheUnderScorer merged commit a573495 into TheUnderScorer:master Apr 10, 2024
4 checks passed
TheUnderScorer pushed a commit that referenced this pull request Apr 10, 2024
## [2.11.0](nx-semantic-release-v2.10.0...nx-semantic-release-v2.11.0) (2024-04-10)

### Features

* release to npm after user defined plugins ([#105](#105)) ([a573495](a573495))
@TheUnderScorer
Copy link
Owner

🎉 This PR is included in version 2.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants