Proposal: Automatically tag releases

166 views
Skip to first unread message

Matt Widmann

unread,
Feb 21, 2016, 6:23:11 PM2/21/16
to elixir-lang-core
I have a package on hex here:

When looking through my git history I noticed all the releases I had made via `mix hex.publish` were never tagged in git. I feel this is good practice and should be encouraged with any package. Should this happen automatically in that mix task (pending a check for the package being a git repository of course)? 

I expected this behavior from using similar tools like rake release in Ruby.

Tobias Pfeiffer

unread,
Feb 22, 2016, 3:13:21 AM2/22/16
to elixir-l...@googlegroups.com

Sounds like a good idea and best practice to me. I don't see any downsides as well

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/5e2ef3ed-95e7-4786-a093-b19566f3e071%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

José Valim

unread,
Feb 22, 2016, 4:54:23 AM2/22/16
to elixir-l...@googlegroups.com
It is unlikely we will add SCM management directly to hex.publish but this is quite easy to add on a project basis. In your mix.exs:

    aliases: ["publish": ["hex.publish", "hex.docs", &git_tag/1]]

    defp git_tag(_args) do
      System.cmd "git", ["tag", "v" <> Mix.Project.config[:version]]
    end

Or something of sorts. This way you have explicit control over what you want to run whenever you publish a package.


José Valim
Skype: jv.ptec
Founder and Director of R&D

--

Matt Widmann

unread,
Feb 22, 2016, 9:44:39 PM2/22/16
to elixir-lang-core
I'm curious what the hesitation is for. Mix already has git and github integration.

I didn't really notice my project wasn't being tagged until someone pointed it out. I doubt most people who aren't in the habit would know or remember to do so either.

José Valim

unread,
Feb 23, 2016, 2:43:12 AM2/23/16
to elixir-l...@googlegroups.com
Because Mix uses git for managing your dependencies, it doesn't touch your project at all. And I don't think we should start adding such knowledge to Mix specially when it is so easily handled with aliases.



José Valim
Skype: jv.ptec
Founder and Director of R&D

On Tue, Feb 23, 2016 at 3:44 AM, Matt Widmann <mgwi...@gmail.com> wrote:
I'm curious what the hesitation is for. Mix already has git and github integration.

I didn't really notice my project wasn't being tagged until someone pointed it out. I doubt most people who aren't in the habit would know or remember to do so either.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.

Peter Hamilton

unread,
Feb 23, 2016, 10:46:12 AM2/23/16
to elixir-l...@googlegroups.com

I agree that read and writing are two very different beasts.

Aliases solve it well, with the exception of added boilerplate.

Is there currently a way for a lib to add aliases? A lib can add tasks to mix automatically. I feel like I'd prefer another task to automatically show up rather than having to add an alias. I'd even go as far as to create a task that calls the other tasks. Then a user can just add it to dependencies and start calling it immediately.


Paul Schoenfelder

unread,
Feb 23, 2016, 12:13:18 PM2/23/16
to elixir-l...@googlegroups.com
I'm -1 on this - it's trivial to add an alias if you need this handled for you, and I would be surprised if I found out that hex was automatically creating tags for me in git when I publish. My current workflow is something like this:

- Commit version bump for <version>
- git tag <version> or git tag <version> -a -m <version notes>
- git push origin master && git push origin <version>
- update issues on GitHub, wait for CI to pass (as a last sanity check)
- mix do hex.publish, hex.docs

If hex was going to create a tag for me, it would almost certainly do the wrong thing. There is also the issue of getting those tags pushed upstream - will you know they are there? is mix supposed to push tags to the remote as well? what if your remote is not named origin? This is subjective/context-sensitive enough where I don't think there is a one-size-fits-all solution, and therefore doesn't belong in mix.

Paul


Matt Widmann

unread,
Feb 23, 2016, 12:19:21 PM2/23/16
to elixir-l...@googlegroups.com
Thanks guys, was just curious what the thought process was. I understand why the flexibility of not having it is more desirable.
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/xIjQQQtoKGY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAK%3D%2B-TsgBQw9agkxv56Wmb_HV91qvZ0VrmUYWKERYKMYC-Aq3w%40mail.gmail.com.

Nathan Long

unread,
Aug 4, 2017, 2:51:28 PM8/4/17
to elixir-lang-core
I just learned about https://github.com/wojtekmach/shipit, which might be what you're looking for.
Reply all
Reply to author
Forward
0 new messages