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: allow always marking releases as stable #1054

Merged
merged 1 commit into from
May 16, 2024

Conversation

mistydemeo
Copy link
Contributor

This adds a new feature which allows users to override our "is this a prerelease" detection.

By default, we use semver mechanics to determine whether a release is a prerelease or not. If it contains anything within the "pre" part of the version number, we mark it as a prerelease. This has several consequences: we won't mark that release as the latest on GitHub, and we won't publish it to sources like Homebrew. This adds a new config flag, always-publish-as-stable; if set, then we always count the release as stable at publish time regardless of what the version number says.

Copy link
Member

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

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

i think we need to update this name and we may need to consider updating some of the built in publish jobs to take this into account. e.g. for npm- npm uses the latest tag to indicate that something is stable. it is automatically added to a new publish IFF the semver isn't a pre-release OR there are only published pre-releases. if someone sets this, has non pre-releases and pre-releases, and then publishes a pre-release to npm, it will Not be marked as stable with our current flow, we would have to add the tag flag. not sure how this works for homebrew but i feel like every package manager will have an opinion on this and i suspect most will need some override to behave as expected

@@ -89,6 +89,9 @@ pub struct DistManifest {
/// Whether to publish prereleases to package managers
#[serde(default)]
pub publish_prereleases: bool,
/// Always publish prereleases as stable, ignoring semver
#[serde(default)]
pub always_publish_as_stable: bool,
Copy link
Member

Choose a reason for hiding this comment

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

i think we might want to call this "force_stable" because we are both publishing as stable and also announcing and so including a stage name might be complicated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems reasonable!

Copy link
Member

Choose a reason for hiding this comment

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

after some thinking, i think force_latest is the best option. latest often implies stable, but we should use the terminology from the release hosts we are leveraging (npm, github) so it's clear we are simply applying that value

@mistydemeo
Copy link
Contributor Author

Hm, the npm case is interesting. Checking the CI config, it seems we don't tell npm what to do with it. Does that mean that npm itself is also parsing the version to guess whether it's a prerelease or not?

@ashleygwilliams
Copy link
Member

@mistydemeo you got it- i would probably want to test to make sure my memory is correct here but i am pretty sure that's the default behavior. we can override this by using this flag: https://docs.npmjs.com/cli/v10/commands/npm-dist-tag

@mistydemeo
Copy link
Contributor Author

We did some checking and determined that npm doesn't infer the prerelease status from the version. For example, this is considered to be the "latest": https://www.npmjs.com/package/@mistydemeo/cargodisttest

This points to something we could improve in our existing "publish prereleases" stuff, but means we don't have to do anything in this PR.

Copy link
Member

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

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

i know you're landing docs and the naming changes soon, so marking this approved!

@mistydemeo mistydemeo merged commit 07e2e2e into main May 16, 2024
16 checks passed
@mistydemeo mistydemeo deleted the force-never-prerelease branch May 16, 2024 18:49
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.

None yet

2 participants