To release a new version of cardano-api, use the Actions > Release workflow (or via CLI):
gh workflow run release.yml -f package=cardano-apiTo override the auto-computed version:
gh workflow run release.yml -f package=cardano-api -f version=8.5.0.0The action (.github/workflows/release.yml) will:
- Compute the next version from
.changes/fragments (or use the explicit one) - Create a
release/<package>-<version>branch - Run
herald batch-- update changelog, bump.cabalversion, remove consumed changelog fragments - Commit, tag, and push the branch and tag
- Open a release PR against the target branch
- Add a
releasechangelog fragment for the next cycle
The release PR URL will be printed at the end of the workflow execution.
🔆 Note
Usually the release PR should only contain a changelog update and a version bump. If you are making a release which aims to contain everything from
masterbranch, there should be no additional code changes in the release PR. An exception to that would be a release with a backported fix for example, where the release PR should contain required code changes too.
💡 Tip
Hold off on tagging and merging of the release PR, until CHaP PR gets merged. See: p. 5 in Releasing to
cardano-haskell-packages.
In case one would like to have more manual control over the release process, it's possible to do what the GHA is doing by hand.
- Run herald to obtain the next version providing the released package name:
nix run github:input-output-hk/cardano-dev#herald -- next cardano-api- Create new branch e.g.
release/cardano-api-8.5.0.0:
git checkout -b release/cardano-api-8.5.0.0- Run herald to generate changelog and release commit:
nix run github:input-output-hk/cardano-dev#herald -- batch --commit-tag- Push the branch, open a release PR.
After verifying the release PR diff that it contains the correct contents, it should be uploaded to cardano-haskell-packages (aka CHaP).
Detailed description of the release process is described in CHaP repository README. Briefly speaking, it requires executing of the following steps:
-
🍀 Clone
cardano-haskell-packages:git clone https://github.com/IntersectMBO/cardano-haskell-packages cd cardano-haskell-packages -
Run the following script, replacing
<commit-hash>with the just tagged commit hash:./scripts/add-from-github.sh https://github.com/IntersectMBO/cardano-api <commit-hash> cardano-api cardano-api-gen
List all packages names for release in the script invocation, after the commit hash like in the example above. The script will create a separate commit for each package.
-
Push your
HEADto a new branch, and create a PR in CHaP. An example release PR which you might want to use as a reference: IntersectMBO/cardano-haskell-packages#345 . -
Merge the PR - you don't need additional approvals for that if you belong to the correct GitHub access group.
After package gets released, you can check the released version at: https://chap.intersectmbo.org/all-package-versions/ and update the version in the dependant packages, in their cabal files, for example:
cardano-api ^>= 8.3Don't forget to bump the CHaP index in cabal.project and flake.lock too. SeeCONTRIBUTING.mdsection on updating dependencies how to to do so.
💡 Tip
CHaP CI build can fail due to various reasons, like invalid haddock syntax. Tagging and merging the release PR after CHaP PR allows to accommodate for potential issues which can arise here.
If the repo has a release pipeline configured, it will be triggered on the tag push.
-
If the release pipeline (if any, see e.g. here for CLI) fails during the Get specific check run status step of the Wait for Hydra check-runs pipeline, this means Hydra did not run on the tagged commit. This can happen if the tagged commit is not the remote
HEADwhen you create the PR, or if you change the tag after the fact.To make hydra run on the tagged commit, checkout this commit, create a branch whose name starts with
ci/(see Hydra's code) and push this branch. Hydra will pick it up and you can then retrigger release creation as follows (the branch from which you execute this command doesn't matter much):gh workflow run "Release Upload" -r $(git branch --show-current) -f target_tag=cardano-api-8.2.0.0. -
If a GitHub release is automatically created by the CI, as visible on https://github.com/IntersectMBO/cardano-api/releases, undraft the release by clicking the pen on the top right, then untick Set as a pre-release, and finally select Update release.
⚠️ GitHub bugIf you try to undraft a PR using the gh API, you will observe that the
PATCHendpoint messes up existing metadata of the release (author, associated commit, etc.). So you HAVE to use the UI, as described above.
If a bug affecting a release is discovered long after that release has been made (and potentially after several subsequent releases), it may be necessary to create a patch that fixes each of the affected legacy versions. We can achieve this through the following steps:
-
Identify the commit that introduced the issue and determine the list of affected releases by checking which tags include that commit (GitHub often displays this list under the commit title).
-
Generate a new patch versions for each of the affected releases. New versions are typically calculated by incrementing the third digit of the latest release in each affected series (see the Version bumping section for more information). By increasing the third or fourth digit, we ensure dependencies automatically pick up the fix.
-
For each version we decide to patch, create a branch starting from the tag of the unpatched version. For example, for
10.14.2.0, we create a new branchrelease/cardano-api-10.14.2.0based on the tagcardano-api-10.14.1.0. -
From each of the release branches, create a dedicated branch for the backported fix, such as
backport/cardano-api-10.14/fix-bug. Cherry-pick the bug fix onto this backport branch, resolving any conflicts that arise. And issue and merge a Pull Request (PR) from the backport branch to the patch release branch (e.g.,release/cardano-api-10.14.2.0).This step can be repeated if multiple bugs need to be patched; create one PR per bug fix.
-
Trigger the Release workflow (see above how to do it). You can also manually create changelog using
herald(see description above). -
Publish the releases to CHaP (Cardano Haskell Packages) in the same way than for normal releases (see Releasing to
cardano-haskell-packagessection): Useadd-from-github.shto create a CHaP entry for each of our new releases, open a PR in the CHaP repository, and once the build passes and is approved, we merge them. -
Unlike in the release workflow for normal releases, for backports, we will not merge the release PR into
master(assuming the backported fix is already there). Attempting to do so may cause issues with conflicts, CI errors, and the risk of the same changes being applied several times tomaster.Instead, we will just close the backport release PRs and open a new PR, directly forked from
master, that will simply update the change-log for all the release PRs we haven't merged. This should be done just once for all the releases, after all the patches have been released.
If you notice that your build fails due to an error similar to the following one:
Configuring library for cardano-ledger-conway-1.8.0.0..
Error: cabal: The following package dependencies were requested
--dependency='cardano-ledger-alonzo=cardano-ledger-alonzo-1.4.1.0-b1d2cdacf3fecf8f57f465701c6cc39a19521597ceee354f7a1ea4688dec9d9f'
--dependency='cardano-ledger-babbage=cardano-ledger-babbage-1.4.4.0-3f75b69fa5a14215f31de708afe86d5d69fbecea8ff284dc3265e0701eada7b6'
however the given installed package instance does not exist.
increase the cabal cache version number in .github/workflows/haskell.yml:
CABAL_CACHE_VERSION: "2023-08-22"Usually setting this date to the current date is enough.
If it is already set to the current date, you can add a suffix to it - the important part is to make it unique across all builds which occurred until now, for example 2023-08-22-1.
This issue happens due to frequent cache collisions in the cabal-cache.