This document describes how Relude is published to the opam repository.
Relude uses GitHub Actions to automatically publish to opam when a new release is created.
The repository must have an OPAM_PUBLISH_TOKEN secret configured with:
- A GitHub Personal Access Token with
public_reposcope - Permission to create pull requests in external repositories (opam-repository)
-
Create a GitHub Release: When a new release is published on GitHub, the CI workflow automatically:
- Validates the
relude.opamfile usingopam lint - Installs the
opam-publishplugin - Configures git credentials for GitHub operations
- Publishes to opam using
opam publish --no-confirmation --tag=<version> .
- Validates the
-
Validation & Dry Run: On every CI run (including PRs), the workflow:
- Validates the opam file using
opam lint - Runs a dry run of the publishing process to ensure it would work
- Creates a temporary tag and tests
opam publish --dry-run
- Validates the opam file using
If automated publishing fails or is not configured, you can publish manually:
# Clone the repository and checkout the release tag
git clone https://github.com/reazen/relude.git
cd relude
git checkout v<version>
# Publish to opam
opam publish --tag=v<version> .Repository maintainers need to:
- Create a GitHub Personal Access Token with
public_reposcope - Add it as a repository secret named
OPAM_PUBLISH_TOKEN - Ensure the token has permission to create pull requests
The relude.opam file and publishing process are automatically tested on every CI run:
opam lint relude.opamOn every non-release CI run, the workflow performs a comprehensive validation of the publishing process:
- Installs the
opam-publishplugin - Verifies package metadata can be read with
opam show --raw . - Validates required opam file fields (homepage, bug-reports, synopsis)
- Checks git repository state
- Confirms publishing prerequisites without actually submitting
To test locally:
# Install opam-publish plugin
opam install opam-publish
# Test package metadata
opam show --raw .
# Validate required fields
grep -q "^homepage:" relude.opam &&
grep -q "^bug-reports:" relude.opam &&
grep -q "^synopsis:" relude.opam &&
echo "✅ Required fields present"
# Check git state
git rev-parse --verify HEAD- Ensure all changes are merged and CI is passing
- Update version in
dune-projectandrelude.opamif needed - Create and publish a new GitHub release with proper version tag (e.g.,
v2.1.0) - The CI workflow will automatically publish to opam
- Monitor the workflow and check for any publishing errors
- Permission errors: Ensure
OPAM_PUBLISH_TOKENhas the correct scopes - Validation errors: Run
opam lint relude.opamlocally to identify issues - Publishing failures: Check the GitHub Actions logs for detailed error messages
For more information about opam packaging, see the official documentation.