How to fix elm publish 'not tagged on GitHub' error?

#1

I am trying to publish an elm package after pushing it to Github at https://github.com/Viir/onlinegamemaker/tree/1.0.0/implement/elm/package/simplegamedev.

But I get this error message from elm publish:

  X Version 1.0.0 is not tagged on GitHub!

-- NO TAG ----------------------------------------------------------------------

Packages must be tagged in git, but I cannot find a 1.0.0 tag.

These tags make it possible to find this specific version on GitHub.
To tag the most recent commit and push it to GitHub, run this:

    git tag -a 1.0.0 -m "new release"
    git push origin 1.0.0

The -m flag is for a helpful message. Try to make it more informative!

Following is the output from git when following the instructions:

> git tag -a 1.0.0 -m "Support elm publish"
fatal: tag '1.0.0' already exists
> git push origin 1.0.0
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

After this error message, I guess the that the remote suggested by elm publish is not right. When I adapt the git command to use the actual remote, it looks like pushing the tag works:

> git push viir 1.0.0
Everything up-to-date

Github displays the tag 1.0.0 in the UI: https://github.com/Viir/onlinegamemaker/tree/1.0.0/implement/elm/package/simplegamedev

But when I run elm publish again, it still says:

Version 1.0.0 is not tagged on GitHub!

What else does elm publish need to see the tag on Github?

#2

I’m not sure if it is the same issue, but maybe related to this? https://github.com/elm/compiler/issues/1904

The name of your repo is different from the name on your elm.json, so maybe that is the issue.

1 Like
#3

Thanks @joakin for the tip!
Yes that issue is related.
I applied the workaround described there and copied the package to a dedicated repository. This seems to work, as elm install recognized the package now. I do not find the package on Ellie yet, which is the goal, but I suspect that is an outdated cache.

I am still interested to learn how elm publish works normally, or if there is a simpler workaround.

#4

As far as I know, elm publish requires that the name in elm.json be <username>/<respository>, corresponding to https://github.com/<username>/<repository>. The elm publish help text telling you how to create GitHub tag that matches the version in elm.json is just that, help text. If you’ve configured your repository in the standard way, with the origin remote corresponding to the master branch, then you can use those commands as is. Otherwise, you have to change them as you did.

If you understand Haskell, you can see details at https://github.com/elm/compiler/blob/master/builder/src/Elm/Publish.hs

2 Likes
#5

Thanks @billstclair for the hint.

That is an interesting idea, where is this coming from? Do you think that it is intended to work this way?

That is good to know. I do not understand Haskell, at least not yet :smiley:
Maybe I can find out more about why it behaves this way in this source code.