Skip to content

Instantly share code, notes, and snippets.

@btbytes
Forked from anmonteiro/dune-release.md
Created August 18, 2023 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btbytes/3a65f059dc8d8ee815add48cfccb8c88 to your computer and use it in GitHub Desktop.
Save btbytes/3a65f059dc8d8ee815add48cfccb8c88 to your computer and use it in GitHub Desktop.

Using dune-release to release OCaml packages

Originally written 2020-05-16

dune-release is a good improvement over the old opam-publish, but releasing software is still clearly not a solved problem, and I find it hard to remember the exact steps involved in releasing an opam package, especially if some time has passed since the last release. This note is an attempt at having a place that I can refer to when occasionally releasing my software to opam.

  1. First things first: lint your opam files:
$ dune-release lint
  1. (Optional) Build a distribution archive to check that the project builds (optionally pass -p pkg1,pkg2) to build just a few packages. I've also found --skip-tests useful here for repos that have e.g. submodules.
$ dune-release distrib
  1. Tag a VCS release in your repository:
$ dune-release tag x.y.z
  1. Distribute the release archive and upload it to GitHub (don't forget to point dune-release at your changelog -- I've found the algorithm for finding the changes file is a little clunky):
$ dune-release distrib && dune-release publish distrib --change-log=./CHANGES.md
  1. Package the opam release:
$ dune-release opam pkg -p pkg1,pkg2 --change-log=./CHANGES.md
  1. Submit the release to the opam repository:
$ dune-release opam submit --change-log=./CHANGES.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment