Need help with Dune config for publishing a package to Opam

I’m trying to publish a package to opam by following https://opam.ocaml.org/doc/Packaging.html#Publishing

But when I do opam install ., I get:

[ERROR] The compilation of jwt failed at "/Users/Sebastian/.opam/opam-init/hooks/sandbox.sh build dune alcotest".

#=== ERROR while compiling jwt.1.0.0 ==========================================#
# context     2.0.0 | macos/x86_64 | base-bigarray.base base-threads.base base-unix.base ocaml-system.4.07.0 | pinned(git+file:///Users/Sebastian/Source/sporto/ocaml-jwt#master#118e0583)
# path        ~/.opam/system/.opam-switch/build/jwt.1.0.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune alcotest
# exit-code   1
# env-file    ~/.opam/log/jwt-75724-e4db2f.env
# output-file ~/.opam/log/jwt-75724-e4db2f.out
### output ###
# dune: unknown command `alcotest'.
# Usage: dune COMMAND ...
# Try `dune --help' for more information.



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
┌─ The following actions failed
│ λ build jwt 1.0.0
└─
╶─ No changes have been performed

My opam config is here https://github.com/sporto/ocaml-jwt/blob/master/jwt.opam
and dune https://github.com/sporto/ocaml-jwt/blob/master/dune

I don’t know how to config this correctly for publishing, any help or example that uses dune would be great. Thanks

I think I got this right now, Still will appreciate if you can tell me if my opam config is correct https://github.com/sporto/ocaml-jwt/blob/master/jwt.opam. Is the with-test correct here?

Yes, this is correct (for opam2) but you’re missing the build and run-test stanzas (like this one, so that’s probably why OPAM doesn’t really know what to do with your package.