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

Skip crate publishing if there have been no changes #711

Merged
merged 3 commits into from
Jun 9, 2021

Conversation

AzureMarker
Copy link
Member

@AzureMarker AzureMarker commented Jun 6, 2021

The last few crate releases have not introduced any changes, but the weekly publishing job has still pumped out new versions:
image

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.

@lnicola
Copy link
Member

lnicola commented Jun 7, 2021

Won't this ignore actual changes to Cargo.toml, like bumping a dependency?

@AzureMarker
Copy link
Member Author

AzureMarker commented Jun 8, 2021

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.

@bors
Copy link
Contributor

bors commented Jun 8, 2021

☔ The latest upstream changes (presumably #710) made this pull request unmergeable. Please resolve the merge conflicts.

@AzureMarker AzureMarker force-pushed the feature/skip-empty-versions branch from ea5bf4c to 05b17cd Compare June 9, 2021 03:35
@@ -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")
Copy link
Contributor

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.

Copy link
Member Author

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).

@jackh726
Copy link
Member

jackh726 commented Jun 9, 2021

r=me after you've looked at @pksunkara's comment (you should have r+ rights)

@bors
Copy link
Contributor

bors commented Jun 9, 2021

☔ The latest upstream changes (presumably #713) made this pull request unmergeable. Please resolve the merge conflicts.

@AzureMarker AzureMarker force-pushed the feature/skip-empty-versions branch from 05b17cd to 04f6c0f Compare June 9, 2021 22:23
@AzureMarker
Copy link
Member Author

@bors r=jackh726

@bors
Copy link
Contributor

bors commented Jun 9, 2021

📌 Commit 04f6c0f has been approved by jackh726

@bors
Copy link
Contributor

bors commented Jun 9, 2021

⌛ Testing commit 04f6c0f with merge b9419bb...

@bors
Copy link
Contributor

bors commented Jun 9, 2021

☀️ Test successful - checks-actions
Approved by: jackh726
Pushing b9419bb to master...

@bors bors merged commit b9419bb into rust-lang:master Jun 9, 2021
@AzureMarker AzureMarker deleted the feature/skip-empty-versions branch June 9, 2021 23:02
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.

5 participants