Hi everyone
I’m excited to share a new GitHub Action I’ve been working on: dune-release-action
If you maintain OCaml packages, you know the drill: every release involves a ritual of commands and manual steps. You need to:
- Ensure your CHANGES.md is properly formatted
- Tag your release
- Run
dune-release
lint + distrib + submit
- Create a GitHub release with the correct changelog section
- Check the opam-repository’s PR
- Oh shit, github token is expired
- Create new token without expiration (??)
- Retry
For me, was following this guide dune-release.md · GitHub by @anmonteiro, but it typically took around an hour per release.
dune-release-action
dune-release-action
automates the entire release workflow in GitHub Actions. Push a git tag, and the action runs dune-release for you with:
- Handles all the `dune-release` orchestration
- Validates your changelog format (right tag exists, etc)
- Creates a GitHub release with proper description (from your changelog section (!!))
- Submits a PR to opam-repository
name: Release
on:
push:
tags:
- '*'
permissions:
contents: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5.3.0
- run: opam install dune-release -y
- uses: davesnx/dune-release-action@v1
with:
package-name: 'your-package'
github-token: ${{ secrets.GH_TOKEN }}
This is very much a one-day half vibe-coded project and it’s hard to test in many use cases, I’m sure there are edge cases and workflows I haven’t considered.
- Repository: GitHub - davesnx/dune-release-action: Automatically release OCaml packages to opam using `dune-release` in GitHub Actions
- Documentation: dune-release-action/README.md at main · davesnx/dune-release-action · GitHub
Looking forward to hearing your thoughts!