Problem updating published package

I have managed to migrate a package over to Elm 0.19 and publish it.

However I am having a problem publishing updates. The sequence I am following is:

  1. Commit and push all changes to master [everything up to date with origin/master]
  2. elm bump [patch change from 1.0.0 to 1.0.1]
  3. git commit -a -m "Bump to 1.0.1"
  4. git push
  5. git tag -a 1.0.1 -m "Release 1.0.1"
  6. git push origin 1.0.1
  7. elm publish

After the publish stage I get the error

The code tagged as 1.0.1 in git does not match the code in your working directory. 
This means you have commits or local changes that are not going to be published!

What perplexes me is that this procedure previously worked in Elm 0.18 (where elm bump was elm-package bump and elm publish was elm-package publish).

Any thoughts on what’s going wrong here or how to diagnose the cause of the problem?

I’m not sure, but don’t you have to git commit the changes as well, before tagging and pushing?

specifically, elm bump will change the elm.json to bump the version. You need to commit that change and push it too. I think the elm compiler can be a bit more helpful in reminding you there.

Apologies, I forgot to add the commit and push stages to my post on discourse (but was committing and pushing the bump change to elm.json in reality). I’ve edited my OP to reflect this.

So the problem still stands as described in my edited OP.

Your procedure looks correct. Have you checked that version 1.0.0 is still in package.elm-lang.org? Some of them disappeared. It won’t be available via search, but you should be able to see it with these URLs (changing billstclair/elm-localstorage to your package name):

https://package.elm-lang.org/packages/billstclair/elm-localstorage/latest

https://package.elm-lang.org/packages/billstclair/elm-localstorage/releases.json

If it is NOT there, then you’ll have to publish it again with version 1.0.0, or maybe one of the Elm maintainers can fix it.

Yes, everything appears to be ok in the package server:

https://package.elm-lang.org/packages/gicentre/elm-vegalite/latest/
https://package.elm-lang.org/packages/gicentre/elm-vegalite/releases.json

Really not sure what to do next.

There’s no 1.0.1 tag on GitHub. Maybe you forgot the git push origin 1.0.1 step.

Looking at the github repo, it seems there is no tag or commits pushed for 1.0.1

One reason for that is you tried moving the version back to 1.0.0 in elm.json, but I think the real problem is the missing tag. Please try changing elm.json back to 1.0.1 and then creating and pushing the 1.0.1 tag:

  1. git tag -a 1.0.1 -m "Release 1.0.1"
  2. git push origin 1.0.1

When I’m ready to release a package, I always do elm publish to let it tell me the Git commands to update the tag. Then I have an Emacs keyboard macro I wrote, bound to c-x c-y, that yanks those lines down to the input area of my shell buffer, so I execute them exactly as elm prints them.

Thanks very much @billstclair and @norpan.

Not sure why my script, which was creating and pushing the tag, didn’t work, but when issuing the commands one at a time, I appeared to be getting a fatal: tag '1.0.1' already exists. Deleting the local copy of the tag (with git tag -d 1.0.1) and then re-running the script seems to have solved the problem. Thanks!

1 Like

I’ve marked this ‘solved’ because I was able to publish after deleting a local tag.

However I think there is still an underlying change between Elm 0.18 and Elm 0.19 publishing. My publishing script, which still generates the problem I first raised is designed to avoid publishing all supplementary assets (stored in docs, images, examples, tests and test-gallery). It does this by creating a temporary reference repo containing only the relevant elm source. You can see the script here:

This used to work under Elm 0.18 (using elm-package) but generates the ...does not match the code in your working directory error as mentioned in my OP.

Any thoughts on how the script would need to change or how to limit publication to only certain assets in the repo?

I always push between the last code change and the tag creation and push. Don’t know if that’s necessary, though.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.