-
Notifications
You must be signed in to change notification settings - Fork 183
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
Skip crate publishing if there have been no changes #711
Skip crate publishing if there have been no changes #711
Conversation
Won't this ignore actual changes to |
When the dev version is committed (ex. v0.1.0-dev.0) it affects the Cargo.toml files and would trigger a new publish cycle, so changes to those files are ignored. Unfortunately this means that Cargo.toml-only changes do not trigger a publish, but I don't expect that scenario would be common. |
☔ The latest upstream changes (presumably #710) made this pull request unmergeable. Please resolve the merge conflicts. |
ea5bf4c
to
05b17cd
Compare
.github/workflows/publish.yml
Outdated
@@ -38,6 +38,14 @@ jobs: | |||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |||
shell: bash | |||
run: | | |||
# Check if we can skip releasing a new version | |||
# (there are no changes and the job was not manually triggered) | |||
export CHANGED=$(cargo workspaces changed --ignore-changes "**/Cargo.toml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need --include-merged-tags
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll include it, but I don't think it's necessary since the publish job always executes on the master branch (this flag adds into consideration tags from merged branches).
r=me after you've looked at @pksunkara's comment (you should have r+ rights) |
☔ The latest upstream changes (presumably #713) made this pull request unmergeable. Please resolve the merge conflicts. |
The [`workflow_dispatch`] event occurs when the job is manually triggered. Manually triggering a publish should skip the empty release check. [`workflow_dispatch`]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
05b17cd
to
04f6c0f
Compare
@bors r=jackh726 |
📌 Commit 04f6c0f has been approved by |
☀️ Test successful - checks-actions |
The last few crate releases have not introduced any changes, but the weekly publishing job has still pumped out new versions:
Now, using the
cargo workspaces changed
command, new crate versions are only published if there has been a change in one of the crates.One interesting effect of using this method is that changes to sections of the project such as the book or main readme (which do not affect the crates) do not trigger crate releases. I don't expect that this will be an issue, but it's important to note.
Edit: I've updated the code to skip the empty release check if the job is manually triggered. This should be a sufficient workaround.