atom / apm

Atom Package Manager
https://atom.io/packages
MIT License
1.27k stars 298 forks source link

Make publish atomic #558

Open bali182 opened 8 years ago

bali182 commented 8 years ago

My regular workflow for publishing a new version of a package is the following:

  1. Do the work on a feature branch
  2. Push it
  3. Merge to master
  4. Publish it using apm

Now it occurred more than once, that I forgot to pull from master before doing an apm publish <version>, to be more general, my local and remote repo was out of sync. It's an honest mistake, I think it can happen to anyone. The problem is, that while apm notifies you about this, a "zombie" version will still be published, that is neither un-publishable, nor re-publishable, it's a persistent reminder of this mistake.

My question is, would it be possible to make apm publish atomic? Meaning that it either succeeds, or leaves no trace in the apm registry (or whatever this data is stored in)?

winstliu commented 8 years ago

:+1:. I've ran into this many times as well. To recover you can use the following steps:

  1. git reset HEAD~1 --hard to erase the Prepare vx.y.z commit
  2. git tag -d <version> to remove the zombie tag
  3. If necessary git push origin :/refs/tags/<version> to remove the tag from the remote

Then git pull and try again.