Comments (5)
If we run getLastRelease with the dist-tag latest, it will say the most recent version is 1.0.0, which isn't true. If analyzeCommits then returns "major", semantic-release will try to release version 2.0.0 and will fail because that version has already been published.
This use case is not currently handled properly by semantic-release
. We currently "assume" the user would not do something incoherent such releasing a version on latest
that is higher than the last version on next
. See semantic-release/semantic-release#563 for the proposed solution.
I believe getLastRelease should always return 2.0.1 in this scenario, regardless of what dist-tag is configured.
The current behavior is intended.
When you are on a branch configured to release on a certain dist-tag you want to make a release on that's dist-tag based on the last version released there.
For example if you configure the master
branch to release on latest
dist-tag and next
branch to release on next
dist-tag. And the last version of the code on master
correspond to 2.0.0
, which is available on latest
, and the last version of the code on next
correspond to the 3.0.0
which is available only on the next
dist-tag.
When you make commits on the next
branch you will release on next
dist-tag, incrementing the last version there.
If you make a fix
commit on master
you want to release 2.0.1
on latest
. With your proposal that would release a 3.0.1
which would contains the code of 2.0.0
+ one fix
commit and not the code of 3.0.0
.
So when semantic-release
runs on master
, getLastRelease
must return the last release of the corresponding dist-tag which is latest
.
from npm.
This use case is not currently handled properly by semantic-release.
I don't think what I describe is a "use-case", but rather how dist-tag
works (I could be wrong).
If you make a fix commit on master you want to release 2.0.1 on latest. With your proposal that would release a 3.0.1 which would contains the code of 2.0.0 + one fix commit and not the code of 3.0.0.
I don't think I'm making a "proposal", but rather reporting a bug.
What if 2.0.1
was already released on your next
branch? You then wouldn't be able to publish 2.0.1
on master
because it's already been published.
from npm.
I don't think what I describe is a "use-case", but rather how dist-tag works (I could be wrong).
The use case I am referring to is to prevent a release when it would create an incoherent situation of 2 release with the same version number having different content. This would be handle by semantic-release/semantic-release#563.
I don't think I'm making a "proposal", but rather reporting a bug.
It's not a bug, as you noted it's by design that npm
prevent to publish the same version twice on different dist-tag.
I don't think I'm making a "proposal", but rather reporting a bug.
I was referring to "I believe getLastRelease should always return 2.0.1 in this scenario, regardless of what dist-tag is configured."
What if 2.0.1 was already released on your next branch? You then wouldn't be able to publish 2.0.1 on master because it's already been published.
This is something that is not supported by npm
and it will fail. That's the expected behavior. npm
dist-tag doesn't enforce anything in your workflow, it's up to you to manage your release workflow to avoid incoherent situation. In that case that means being certain to not release a version that has been released before.
If you have a 2.0.0
on master
/latest
and a 2.0.1
only on next
and you want to push a fix on top of the 2.0.1
then you have to make 2.0.1
available on latest
and then push your fix, so 2.0.2
will be published.
from npm.
I think I understand the use-case you're describing. I'd argue that, unless you fully understand (and expect) this workflow, it'd be easy to shoot yourself in the foot with how this works by default. Anyway, thanks for taking the time to explain!
from npm.
it'd be easy to shoot yourself in the foot with how this works by default
Yes. dist-tag are way more complex than what they look like at first. Especially regarding edge cases.
That said, the case explained in this comment where you'd end up releasing a 3.0.1
with the code of 2.0.0
+ the fix commit, and without all the 3.0.0
related code committed on next
is even wort because you would end up with a release that is incoherent. The case in which we attempt a 2.0.1
release that failed is a bit better because because at least no wrong release has been done.
Hopefully with semantic-release/semantic-release#563 none of this scenario would happen as semantic-release
would handle both the release and the change of dist-tag.
from npm.
Related Issues (20)
- npm whoami failing HOT 3
- `package.json` version not updated, despite correct plugin ordering HOT 1
- Set --no-workspaces with npm version HOT 2
- Command failed with exit code 1: npm version 0.22.2 --userconfig HOT 2
- error on publishing HOT 1
- Publishing failed since update from [email protected] to [email protected] with files mentioned in .gitignore HOT 6
- Update a package.json in a sub folder
- CVE-2023-42282 HOT 1
- Support for custom package.json properties to write changelist entries
- NPM Audit Signatures issue on 11.0.3 HOT 2
- Failed step "prepare" of plugin "@semantic-release/npm" due to reading malformed path HOT 13
- ERR_INVALID_AUTH triggered by semantic-release npm despite not having this field set in checkout directory HOT 11
- semantic-release seems publishing twice and causing error. HOT 1
- Security Issue with out of date [email protected] found with SNYK HOT 3
- Array format/style is being changed HOT 3
- improve auth token resolution
- align approach for concatenating `.npmrc` files to better align with default npm behavior
- account for deprecation of `_auth` in existing `.npmrc` files
- Cannot set properties of null (setting 'peer') HOT 4
- npm ERR! log.http is not a function HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from npm.