sheerlox
Hello, Elixir community!
I’m excited to introduce a new tool that aims to streamline version management and release processes for Elixir projects: semantic-release-hex.
Disclaimers
Before we dive in, I want to clarify that semantic-release-hex is a JavaScript library designed to enhance version management and release processes in Elixir projects. While it’s not an Elixir library per se, its integration with Elixir projects can bring the power and simplicity of semantic-release to your workflow.
I also want to mention that although it’s only been two weeks, I’ve recently been invited to the semantic-release organization. The reason I’m developing this library is unrelated to my membership in the organization and is solely motivated by my complete trust and utter admiration for that project, which I’ve been using for more than 6 years in all of my projects, both personal and professional.*
Why?
In the course of developing a SaaS project with Elixir & Phoenix, I encountered the challenge of automating version management while adhering to best practices. Initially being a JavaScript developer, I turned to the reliable semantic-release tool but found it lacking in Elixir integration. This led me to create semantic-release-hex.
semantic-release features
- Determining the next version number
- Generating release notes & updating the changelog file
- Creating a git tag
- Publishing GitHub/GitLab releases
- Commenting on released Pull Requests/Issues
semantic-release-hex features
- Updating the version in
mix.exs
semantic-release-hex roadmap
- Updating the version in
README - Updating the version in
Mix.install/2scripts - Distributed as a
hexpackage (similar totailwind) - Publishing to Hex
Benefits
- Fully automated release
- Enforce Semantic Versioning specification
- New features and fixes are immediately available to users
- Notify maintainers and users of new releases
- Use formalized commit message convention to document changes in the codebase
- Integrate with your continuous integration workflow
- Avoid potential errors associated with manual releases
- Simple and reusable configuration via shareable configurations
Trying it out
I’ve set up a demo repository to showcase what that would look like in an Elixir project: semantic-release-hex-demo. Feel free to explore its content, commit history, or even fork it to test things out, as it’s what it’s meant for.
You will also find detailed instructions on how to set it up in your own Elixir project on the main repository.
I’m eager to hear your thoughts, answer any questions, and discuss how semantic-release-hex can enhance your Elixir projects!
Also, if you’d like to share your views on features currently being specified/implemented, don’t hesitate to visit the Discussions/Issues for feature requests.
Thank you for reading ![]()
Acknowledgements
Special thanks to @Eiji and @D4no0 for their invaluable feedback!
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #elixirconf-us
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Eiji
Isn’t it easier to create a
mixtask which firstly guess based on configurable prefix (let’s say: "fix: ") and then asks for a type of version change giving the guessed one as default (to just press enter)?Some projects would need to add
nodeas extra environment dependency which is not always a good idea. If we are going to simplify one thing we shouldn’t complicate other one. For me it’s simple on my laptop, because I useasdf, but not everyone is in such case. Also obviously the documentation is not onhexwith all of it’s side-effects which may be confusing especially for new developers.Does it have any strict format or it’s configurable somehow?
Does it creates a
gittags automatically as well (git checkout v1.x.yor so)?What is the comment content? Is it configurable? How about
wiki?For me the best documentation is:
wikiasuserperspectiveissueasdeveloperperspectivepull requestas implementation detailsHow about
InstallationinREADME.mdfile? It should be easy to find in markdown as long as you know the project name and previous version.Those links are relative, so browser searches it on this forum …
sheerlox
I thought about making an actual Elixir library to solve the issue at hand.
However,
semantic-releaseis the industry standard battle-tested tool (was created almost 10 years ago and is the 128th most depended upon package on NPM, ahead ofjquery,underscore,babeland lots of other staples), packs in a lot of useful features (e.g. support for pre-release / maintenance branches) and is highly configurable to suit almost any workflow.For these reasons, while it would be extremely instructive to try and create an Elixir equivalent, I don’t think reinventing the wheel is a good use of time, especially when there is virtually no downside to using (and extending) the already available tooling.
Technically, because
semantic-releaseis made with a CI-first approach in mind, it doesn’t have to ever be run locally. Because of this, the Node.js environment dependency is only in the release workflow file. Node.js is required locally only when initializing the tool, to install the packages and run the dry-run to check everything is working as expected.I’m not sure what you mean by “side-effects”, but I don’t think not having the documentation on
hexis an issue, since this isn’t an Elixir library per see, and the only place it will be referenced is in the release configuration. Similar to CI tools, where you wouldn’t expect GitHub Actions documentation to be on Hex, the relevant documentation is readily available where it’s most relevant.This is fully configurable by choosing an existing conventional changelog preset, or creating your own by forking one of the existing presets and making adjustments as I did (to be exact it is a maintained fork) with
@insurgent/conventional-changelog-preset(which includes all commit types and adds emojis before categories). You can take a look at the relevant source code inlib/commit-transform.js. But note that with all the available presets, you probably don’t have to create a new one.Yes, I forgot to mention that in the post, but
semantic-releasetags the version to the release commit before creating a GitHub/GitLab release, as it actually relies heavily on tags (e.g. to determine the current version).You can take a look at an example comment here: semantic-release/semantic-release#3062 (comment).
It is also fully configurable, please refer to the
semantic-release/githuboptions documentation if you’d like to know more.Regarding the wiki, I’m not sure what you mean by that. Could you please expand on the use case(s) you have in mind?
That’s actually a very good idea, thank you so much! I’ll be adding it to the feature requests and will start working on it as soon as it is specified correctly (btw if you’d like to share your views on features currently being specified/implemented, don’t hesitate to visit the Discussions/Issues for feature requests).
Sorry about that, thanks for pointing this out I’ll fix them immediately.
Thank you so much for responding to my post to share your views and concerns, and I hope I’ve addressed them as best as possible
D4no0
I’m also not a big fan of installing node and random JS packages either on dev or CI/CD, I am tired of redoing the CI script every few months because of some forced “deprecations” introduced in the ways to install node or other js packages.
If the implementation of the package is what matters, I think making a CLI and packaging it together with a elixir library, just like tailwind does is a much more sane approach and would make everyone happy by not caring about any implementation details.
sheerlox
Unrelated: superfluous defense of Node.js and NPM
As a JavaScript developer for more than 10 years, I’m not aware of any such “forced deprecations” requiring substantial changes to CI workflows.
For example, the official GitHub Action
setup-nodedid not make changes to its interface betweenv1andv4(current version) other than renaming theversionoption tonode-versioninv3.0.0(and adding a lot of non-breaking features, e.g. support for.tool-versions).Similarly, the interface of a basic
), but breaking changes never were an issue, at least for me. Searching through
npm installcommand did not change between the (pre-v1) 2010 specification and today’s latest (v10) documentation. Of course, the way NPM handles the installation and optimization of packages changed a lot under the hood (thank god, because the early days were … something@npm/clireleases supports those claims.It’s also worth mentioning that Node.js releases LTS versions, which “typically guarantees that critical bugs will be fixed for a total of 30 months”.
That being said, I can understand that one might not want to install a Node.js runtime and packages in an Elixir project, even if only on the CI.
I really like your idea of packaging the library in a
hexpackage!Unfortunately, there’s a major difference between
tailwindandsemantic-release, being that the former is a frontend library (hence it runs in the browser). If we were to try and do the same thing forsemantic-release, I’m afraid we’d have to bundle a Node.js runtime inside thehexpackage, which I don’t think would be either a practical or good idea and might even not be possible at all.EDIT: I realized you were mentioning that Elixir’s
tailwinduses the Tailwind standalone CLI under the hood, and so does not require having Node.js installed. I wasn’t aware of that, and it definitely looks very interesting, I’ll be looking further into it!Anyway, I’ll be looking into this idea further, even if that means installing the Node.js runtime on the CI separately. That would allow to simplify the installation process and also provide a
mixtask for running the release. Thanks for the great suggestion!Eiji
ex_docas well as everything inElixirenvironment is extremely powerful. As long as yo have it as a dependency you can easily link to every it’s module, function and so on. No matter how good or not is it, it would never support every possible source (not onlynpm). Therefore the developer who want to describe everything in details in a guide would need to use absolute urls. In my personal opinionElixir’s documentation tool output looks brillant and I’m really used to it. Suddenly changing a look like feeling of documentation by clicking on “some url” is not … handy.Since the documentation could not be found on hex or hexdocs page and Google uses a terrible algorithms it may be hard to find such tool. How much people are searching for a package here on forum? Keep in mind there is “hex” in the project name it’s of course correct on one side, but confusing on the other one as what developer expects is not what is provided.
That would be my first thoughts …
Having a tool outside of the ecosystem is of course your decision, but it’s rather a matter of time for a side-effects to come. It’s like a butterfly effect. If some (even small) % of developers would have trouble search for it then in long term it would not give anything good.
Of course I may be wrong here, because I’m writing it from my perspective. For example in many cases I already had a desired page on some nth results page. As above I’m not searching for a specific package/tool on forum, but rather on hex/hexdocs.
I’m really not sure what to recommend here. Maybe try to go a similar route in the
Phoenixassets. Instead of usingnpmthey are downloading some tools (esbuild and tailwind) and run them as watchers. Of course watchers here does not makes sense, but I don’t know … downloading a standalone node binary (if possible) to some directory and call your code (likeinstall_and_runin watchers config). Therefore most of your code would stay onnpmand you could keep documentation including guides forElixirstuff on hexdocs making it’s easier to find. Does it makes sense for your case?Edit: Oh, actually @D4no0 proposed it before me.
Not really … it’s like a … web service. I mean you do not care in which language
Slack APIwas created. TheAPIitself is not a part of environment, but it’s a 3rd-paty service to integrate. Also if such a web service is related to language environment then we have for example aSlack API clienthex dependency which instead giving tons of links toSlack APIdocuments everything on hex. As long as it works “nobody cares” how it works i.e. it could be aREST APIorGraphQLone - the hex package gives it’s ownElixir’s API.I had not idea how your code is working, so I was wondering if there was some AI-based text generators, so actually never mind
sheerlox
That all makes total sense, I now understand your point about having the documentation on
hexdocs, which would be even further solidified by the creation of an Elixir package abstracting the installation and release mechanisms associated with Node.js. I really like this solution and have already started looking into it.I’m not aware of any mention of a standalone release of
semantic-release-cli, but that will be a great addition to the tool that I’m sure the core team will welcome with enthusiasm! I’ll run the idea by them while working on a prototype.Regarding the AI-based documentation generator,
semantic-releaseindeed does not ship with that feature, but maybe someone will create a plugin for that in the futureThank you for being so patient with me, your input is really valuable and highly appreciated!
thiagomajesk
I have used another lib called git_opts before, which is written in Elixir. Out of curiosity: did you find any specific functionality lacking in the ecosystem that prompted you to create another library?
sheerlox
git_opsseems to be lacking the following:Ultimately, its missing git & CI integrations make it unable to be fully automated easily.
I had noticed
git_optswhile researching the topic, but thought it was unmaintained due to misreading “Jun 21” for `“June 2021”. I now realize the package receives a bit of attention.Though
git_opslooks like a great project and would have the benefit of allowing any Elixir developer to contribute without knowing JavaScript, I think it is unfortunate that someone would invest their time in reconstructing a tool from scratch when there’s practically no drawback to utilizing and enhancing the existing tooling (as I stated before).semantic-releaseis a mature and stable tool, with features that would take months (or even years) to develop ingit_opswith a dedicated and active team. This is what led me to believe creating a bridge between Elixir andsemantic-releaseto bring its capabilities to the ecosystem was the best solution.Disclaimer: I haven’t mentioned that before as it did not seem relevant since it’s only been two weeks, but I’ve recently been invited to the
semantic-releaseorganization. The reason I’m developing this library is unrelated to my membership in the organization and is solely motivated by my complete trust and utter admiration for that tool, which I’ve been using for more than 6 years in all of my projects, both personal and professional.sheerlox
In case that’s of interest to anyone, here’s the GitHub Discussion I just created on
semantic-releasewhich will host the exchanges with the core team regarding this project:I’ve mentioned the need for creating an official standalone executable, required to bundle everything as a
hexpackage, and the possible approach to fulfill that requirement. I’m waiting for their preliminary feedback before beginning any work.georgeguimaraes
Thanks for creating
semantic-release-hex. I think it’s a great addition to the semantic-release ecosystem.I think that the Elixir community is not so keen on using tools like semantic-release to continuously release libs and generate CHANGELOGs. I think the majority of us are publishing our libs manually to hex.
I’ve been using semantic-release in my plugins for Logseq (the open-source outliner note-taking app) since that’s the recommended way of releasing Logseq plugins. Although I admit it was a bit confusing to set up, I’m really enjoying committing stuff using
feat: new feature hereand that immediately triggering a new version and release.I thought about creating something like semantic-release for Elixir, but as you said, there’s lots of functionality. I particularly enjoy all the PR comments when you release a new version.
I’m not maintaining any Elixir lib right now, but if I do, I’ll sure use
semantic-release-hex. Thanks and congrats!