-
Notifications
You must be signed in to change notification settings - Fork 454
Doc describing binary distro of app with dune pkg #12745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gridbugs
merged 1 commit into
ocaml:main
from
gridbugs:doc-github-action-for-releasing-binaries
Nov 20, 2025
+71
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| How to Release a Binary Distribution of an Application on Github with Dune | ||
| ========================================================================== | ||
|
|
||
| This guide will show you how to write a Github Action which builds a binary | ||
| distribution of an application for various platforms using Dune package | ||
| management, and uploads the compiled artifacts to a Github release. | ||
|
|
||
| We'll make a workflow called "Release" which will run every time a tag is pushed | ||
| to the repo on Github. The workflow will build the project for the targets | ||
| ``x86_64-linux``, ``x86_64-macos``, and ``aarch64-macos``, and then upload a | ||
| gzipped tarball of the built artifacts to a Github release named after the tag. | ||
|
|
||
| Dune will be installed by the `setup-dune | ||
| <https://github.com/ocaml-dune/setup-dune>`_ action. | ||
|
|
||
| The following is the manifest for a Github Action workflow which releases a | ||
| binary distribution of a package named ``my_app``. | ||
|
|
||
| .. code:: yaml | ||
|
|
||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - '*' | ||
|
|
||
| jobs: | ||
| release-unix: | ||
| name: Release for ${{ matrix.name }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: macos-15-intel | ||
| name: x86_64-macos | ||
| - os: macos-15 | ||
| name: aarch64-macos | ||
| - os: ubuntu-latest | ||
| name: x86_64-linux | ||
| steps: | ||
|
|
||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Install Dune | ||
| uses: ocaml-dune/setup-dune@v0 | ||
|
|
||
| - name: Build the project | ||
| run: dune build @install --release --only-packages my_app | ||
|
|
||
| - name: Set environment variable to the archive name minus the file extension | ||
| run: echo OUT_NAME=my_app-${{ github.ref_name }}-${{ matrix.name }} >> $GITHUB_ENV | ||
|
|
||
| - name: Release a tarball of build outputs | ||
| run: | | ||
| mkdir -p "$OUT_NAME" | ||
| cp -rlf _build/install/default/* "$OUT_NAME" | ||
| tar czf "$OUT_NAME.tar.gz" "$OUT_NAME" | ||
|
|
||
| - name: Upload artifacts | ||
| uses: ncipollo/release-action@v1 | ||
| with: | ||
| allowUpdates: true | ||
| artifacts: "*.tar.gz" | ||
|
|
||
| With the above manifest in a file ``.github/workflows/release.yml``, whenever a | ||
| tag is pushed to the repo, gzipped tarballs will be uploaded to a new release of | ||
| the project named after the tag, in files named | ||
| ``my_app-<TAG>-x86_64-linux.tar.gz``, ``my_app-<TAG>-x86_64-macos.tar.gz``, and | ||
| ``my_app-<TAG>-aarch64-macos.tar.gz``. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.