Skip to content

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

Merged
JamesHenry merged 4 commits intomasterfrom
release-git-push-options
Dec 18, 2024
Merged

feat(release): allow automated git push from version or changelog step#29280
JamesHenry merged 4 commits intomasterfrom
release-git-push-options

Conversation

@JamesHenry
Copy link
Copy Markdown
Contributor

@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

@vercel
Copy link
Copy Markdown

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

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Dec 10, 2024

@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
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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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

@JamesHenry JamesHenry merged commit 73735ca into master Dec 18, 2024
@JamesHenry JamesHenry deleted the release-git-push-options branch December 18, 2024 09:29
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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

3 participants