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

Simplify Cargo metadata for publish = false crates #181

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

edmorley
Copy link
Member

As of Cargo 1.75 the version property in Cargo.toml is now optional, and if omitted is the same as having specified version = "0.0.0" and publish = false:
https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-175-2023-12-28
https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field

Therefore for crates that we do not publish, we can now remove both the version and publish properties, avoiding the need for the fake 0.0.0 version that differs from the actual buildpack version in buildpack.toml.

GUS-W-14821120.

As of Cargo 1.75 the `version` property in `Cargo.toml` is now optional,
and if omitted is the same as having specified `version = "0.0.0"` and
`publish = false`:
https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-175-2023-12-28
https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field

Therefore for crates that we do not publish, we can now remove both
the `version` and `publish` properties, avoiding the need for the fake
`0.0.0` version that differs from the actual buildpack version in
`buildpack.toml`.

GUS-W-14821120.
@edmorley edmorley self-assigned this Jan 15, 2024
@edmorley edmorley marked this pull request as ready for review January 15, 2024 16:31
@edmorley edmorley requested a review from a team as a code owner January 15, 2024 16:31
@edmorley edmorley enabled auto-merge (squash) January 15, 2024 16:31
@edmorley edmorley merged commit 984b5bc into main Jan 15, 2024
2 checks passed
@edmorley edmorley deleted the edmorley/rm-publish-false branch January 15, 2024 18:51
edmorley added a commit that referenced this pull request Jan 26, 2024
The `version` and `publish` fields were removed in #181 since they
are now optional for crates that are not published to crates.io.

However, even though this crate isn't published to crates.io, the
`version` field is still used/set as part of the current GitHub Releases
publishing process, which uses `cargo-bump` to generate an appropriate
new version number based on the major/minor/patch workflow input.

Fixes:

```
$ cargo bump 0.3.10
thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-bump-1.1.0/src/main.rs:57:14:
toml has version
```

Seen in:
https://github.com/heroku/languages-github-actions/actions/runs/7669085052/job/20902261440#step:9:10
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.

2 participants