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

feat(release): allow automated git push from version or changelog step #29280

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

JamesHenry
Copy link
Collaborator

@JamesHenry JamesHenry commented Dec 10, 2024

Current Behavior

An automated git push only takes place if absolutely necessary, namely when we are creating a github release. The user cannot opt into it occurring automatically when not creating a github release, they need to run git push outside of nx release.

Expected Behavior

An automated git push can be opted into by the user via config or the CLI, for the version or changelog phases. There should be no breaking change, push will always default to false on the version subcommand, and default to false for the changelog subcommand except when a github release has been opted into.

If a user attempts to disable git push but also enable GitHub releases, this will be reported as invalid upfront during config validation.

Related Issue(s)

Fixes #22073

Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Dec 11, 2024 8:58am

@JamesHenry JamesHenry marked this pull request as ready for review December 11, 2024 08:47
@JamesHenry JamesHenry requested review from a team as code owners December 11, 2024 08:47
@@ -701,11 +701,6 @@ describe('nx release circular dependencies', () => {

Would stage files in git with the following command, but --dry-run was set:
git add {project-name}/package.json

NX Your filter "{project-name}" matched the following projects:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This a solid improvement, previously the nx release "meta command" would end up repeating the same project filters because each subcommand was logging it directly as well


if (shouldCreateWorkspaceRelease && changelogResult.workspaceChangelog) {
if (!hasPushedChanges) {
throw new Error(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is here is a safety fallback, but it shouldn't be possible to reach this point because the invalid combination should be caught upfront during config validation


hasPushedChanges = true;
throw new Error(
'It is not possible to create a github release for the project without pushing the changes to the remote, please ensure that you have not disabled git push in your nx release config'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is here is a safety fallback, but it shouldn't be possible to reach this point because the invalid combination should be caught upfront during config validation

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

Successfully merging this pull request may close these issues.

nx release not pushing the changes to source-control
2 participants