package dune-release
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4f97a053105eea0ba4097a3bed31f8fc93728ea49d9292912dd2f1b9ff02683f
sha512=468e6174be404c1ee535d65e5e7cc678c21ac6032edc7fcaae6c1066eb6511d8cd7aa1101f5c50c94551ad4d0a41435b3a9f30a81ff111173805ea51e9a360a8
Description
Added to opam-repository:
README
dune-release: release dune packages in opam
dune-release is a tool to streamline the release of Dune packages in opam. It supports only projects be built with Dune and released on GitHub.
Installation
dune-release can be installed with opam:
opam install dune-releaseDocumentation
The dune-release command line tool is extensively documented in man pages available through it's help system. Type:
dune-release help release # for help about releasing your package
dune-release help # for more helpCalling dune-release without any argument will start the automated release process, composed of the following steps:
- create the distribution archive;
- publish it online;
- create an opam package;
- submit it to OCaml's opam repository.
If the repository contains multiple opam packages, dune-release will try to release all of them by default (ie. one tarball, one github release but several opam files added to the opam repository).
The most basic workflow is:
dune-release tag
dune-releaseEach step is refined and explained with more details below. By default dune-release asks for permission before taking any significant action so you should not be afraid of running it.
Tag the distribution with a version
This step should be executed prior to running the dune-release automated process.
The tagging command of dune-release will extract the latest version tag from the package's change log and tag the VCS HEAD commit with it if it is invoked without argument:
dune-release tagThis will only work if the change log follows a certain format. The version number must be in the first item of the change log file (usually a section title). Asciidoc and Markdown files are supported. A typical example of such version in a markdown file is:
## v1.0.1 (2019-09-30)The version extracted from this change log will be v1.0.1. This will be used to infer the tag of the release as well as generate the publication message. If you do not want to rely on this extraction you can specify it on the command line:
dune-release tag v1.0.1You can also directly use your VCS instead if the dune-release tag command does not fit your needs. Note that dune-release and dune only work with annotated tags (i.e. tags created with git tag -a) and that if you want to take care of the tagging yourself you should take this into account.
If you need to delete a tag created by dune-release, use the following command:
dune-release tag -d v1.0.1The full documentation of this command is available with
dune-release help tagCreate the distribution archive
Now that the release is tagged in your VCS, generate a distribution archive for it in the build directory with:
dune-release distribThis uses the source tree of the HEAD commit for creating a distribution in the build directory. Note that any uncommitted change will therefore be ignored. The distribution version string is the VCS tag description (e.g. git-describe) of the HEAD commit. Alternatively it can be specified on the command line.
Basic checks are performed on the distribution archive when it is created, but save time by catching errors early. Hence test that your source repository lints and that it builds in the current build environment and that the package tests pass.
dune-release checkThe full documentation of this command is available with
dune-release help distribExcluding files with .gitattributes
Files marked with the export-ignore attribute in .gitattributes will be excluded from the distribution archive. This can be used to exclude development files like dune-workspace that should not be included in releases.
Example .gitattributes:
dune-workspace export-ignore
.github/** export-ignoreSupported patterns:
- Exact filenames:
dune-workspace - Directory patterns:
.github/**(matches all files under.github/) - Glob patterns:
*.log,test_*,file?.txt - Double star in path:
**/build,src/**/test.ml - Path normalization: handles
./and../in paths
Unsupported pattern syntax (such patterns are skipped with a warning):
- Negation patterns (
!pattern) - Escaped patterns (
\!for literal!) - Quoted patterns (
"a b"for patterns with spaces) - Character classes (
[abc])
Other limitations:
- Only the repository-root
.gitattributesis read; files in subdirectories are ignored. - Matching is always case-sensitive;
core.ignorecaseis not consulted.
Publish the distribution online
Once the distribution archive is created you can now publish it with:
dune-release publishThis means creating a Github release associated with the tag and upload the distribution tarball as a release artifact.
The full documentation of this command is available with
dune-release help publishPublish troubleshooting
If github returns a Permission denied error during dune-release publish, the reason is probably a failing ssh connection. In that case, we suggest that you set up ssh. If you prefer not to and you've already set up https instead, we suggest that you configure git as follows:
git config [--global] url."https://github.com/".pushInsteadOf "git@github.com:"Running that line once will configure git to always push over https - either for that repository or globally.
In more detail: dune-release publish always pushes to github over ssh by explicitly giving git the github uri of your project with ssh prefix (git@github.com:). By configuring git as suggested above, git will automatically replace that prefix by the https one when pushing and push over https instead.
Even if you set up ssh, the connection may fail when you cloned your project using a ssh alias (to mannage the ssh key to be used). The uri prefix to your github repository can be extracted from the result of the next command:
git config --get remote.origin.urlIn such a case, we suggest that you configure git as follows (where my-ssh-alias-to-github is the uri prefix to your github repository) :
git config [--global] url."git@my-ssh-alias-to-github:".pushInsteadOf "git@github.com:"Create an opam package and submit it to the opam repository
To add the package to OCaml's opam repository, we start by creating an opam file to be used on the opam repository. This file includes the download URI for the distribution tarball and the tarball hash:
dune-release opam pkgTo submit the package to the opam repository and create the associated pull request we run:
dune-release opam submitThe full documentation of this command is available with
dune-release help opamImportant Notes
Most of the code in this repository has been written and has already been released part of the topkg tool.
The main differences between dune-release and topkg are:
- Remove
pkg/pkg.ml; - Assume the project is built with dune;
- Bundle everything as a single binary;
- Use of
Astring,Logs,FpathandBos; - Remove the IPC layer (which is used between
topkgandtopkg-care);
Runtime dependencies
bzip2can be set with theDUNE_RELEASE_BZIP2variable (deprecated), otherwise it is expected to be inPATH;tarcan be set with theDUNE_RELEASE_TARvariable (deprecated), otherwise it is expected to be inPATH;gitcan be set with theDUNE_RELEASE_GITvariable (deprecated), otherwise it is expected to be inPATH;hgcan be set with theDUNE_RELEASE_HGvariable (deprecated), otherwise it is expected to be inPATH;dune,curlandcpare expected to be inPATH.
Using these DUNE_RELEASE_* environment variables to configure the path to these binaries is deprecated since dune-release.1.4.0; rely on the PATH variable instead.
Contributing
While this project is in the Tarides organization, contributions from others are very much welcome. We're trying to build a tool that works for many users.
If you're unclear whether a feature would fit the scope of dune-release don't hesitate to open an issue to gauge the interest.
Please read the guidelines before contributing.
Dependencies (17)
Dev Dependencies (2)
-
ocamlformat
= "0.29.0" & with-dev-setup -
alcotest
with-test
Optional Dependencies
None
Used by (5)
Conflicts (1)
-
result
< "1.5"
Build status
Results of building dune-release with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 2.3.0 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure