Publishing two packages at once on opam?

I’m working on two related packages: bin_there and ppx_bin_there. They should be kept synchronized, but the latter depends on the former.

What’s the best way to push to opam? First bin_there, then wait until it’s merged, then ppx_bin_there?

Ideally, I’d like to publish automatically from my CD, is this a possible flow?

I always publish the set of ortac packages (6 packages with dependencies among them) together in one PR on opam-repository. This never has been a problem. You may have to do the PR by hand / your own script rather than relying on opam-publish or dune-release depending on where are the packages.

(I don’t know about automatically publishing from CD).

I have two packages - CamlPDF and Cpdf, which must be synchronized. And it’s no problem to submit separately - we just make sure Cpdf’s opam file requires an equal version of CamlPDF - say v2.9 requires v2.9.

In some other package managers - say Fedora - special mechanisms are required, because it will always want to supply the latest version available. But not so with opam.

It goes like this:

depends: [
“ocaml” {>= “4.10.0”}
“ocamlfind” {build}
“camlpdf” {= version}
]

I don’t know how to do that “from your CD” and I’m not familiar with enough CD setups to likely be able to answer this part of your question.

As for the rest:
You can publish two packages at once by including both opam file additions in the same PR on opam-repository. This is the normal way that opam publish handles multi-packages repository. Check out, e.g., 2 packages from ocsigen/lwt at 6.1.0 by raphael-proust · Pull Request #29295 · ocaml/opam-repository · GitHub

I automated the publication of some of my packages with GitHub - davesnx/dune-release-action: Automatically release OCaml packages to opam using dune-release in GitHub Actions · GitHub

It pushes a opam-repository PR on each tag (with the option to keep a CHANGES.md file) in sync with the github tag and opam package PR