Skip to content

Respect dev-repo argument when publishing releases - #522

Merged
Leonidas-from-XIV merged 3 commits into
tarides:mainfrom
shonfeder:respect-dev-repo
Aug 12, 2026
Merged

Respect dev-repo argument when publishing releases#522
Leonidas-from-XIV merged 3 commits into
tarides:mainfrom
shonfeder:respect-dev-repo

Conversation

@shonfeder

@shonfeder shonfeder commented Aug 10, 2026

Copy link
Copy Markdown
Member

Fixes #521

The release publication workflow was not respecting a configured dev-repo, instead always deriving the repo to release on from the opam file.

This is fixed by relating the derivation of the repo info a supplied dev_repo value, when the latter is given. If the dev repo is not given, we fallback to the old behavior, if it is, we use this value to derive the repo information which is eventually used for the API call to publish the release to github.

I made a go at adding tests, but soon discovered that the code does not seem suitably organized to support testing these parts of the logic: they cannot be exercised by cram tests with --dry-run because --dry-run logic skips non-mutating observation of the system, such as reading the opam file (https://github.com/shonfeder/dune-release/blob/respect-dev-repo/lib/opam.ml#L220) and it cannot be exercised in unit tests, since the pure core of the computations is not isolated from the effecting execution logic.

If there is already a known strategy for adding tests for these kinds of changes, a pointer would be welcome.

cc @Leonidas-from-XIV

@Leonidas-from-XIV
Leonidas-from-XIV self-requested a review August 11, 2026 07:27
shonfeder and others added 3 commits August 11, 2026 10:17
The release publication workflow was not respecting a configured
dev-repo, instead always deriving the repo to release on from the opam
file.

This is fixed by relating the derivation of the repo info a supplied
`dev_repo` value, when the latter is given. If the dev repo is not
given, we fallback to the old behavior, if it is, we use this value to
derive the repo information which is eventually used for the API call to
publish the release to github.

@Leonidas-from-XIV Leonidas-from-XIV left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've rebased on main to update the changelog and pick up the new formatter version. Looks good to me.

I agree that the tests can't be really used that much when dealing with Github interaction since there isn't a good separation between computation and network interaction. But this looks simple and sensible enough.

@shonfeder

Copy link
Copy Markdown
Member Author

Thanks for the rebase and confirmation about the testing! I'll run some tests on my machine today confirm its working as expected and report back :)

@shonfeder

shonfeder commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

Manual testing on by fork of dune-release worked as expected:

$ dune exec dune-release -- tag
[-] Extracting tag from first entry in CHANGES.md
[-] Using tag "3.3.0"
[?] Create git tag 3.3.0 for HEAD? [Y/n]
y
[+] Tagged HEAD with version 3.3.0
↳[0]

$ dune exec dune-release -- --dev-repo=git@github.com:shonfeder/dune-release.git --opam-repo=shonfeder/opam-repository

[+] Distribution for dune-release 3.3.0
[+] Commit 02dd8e19cbf6bc67aad3414979da6cce477e8d35
[+] Archive _build/dune-release-3.3.0.tbz
[-] Publishing distribution
[-] Publishing to github
[?] Push tag 3.3.0 to git@github.com:shonfeder/dune-release.git? [Y/n]
y
[-] Pushing tag 3.3.0 to git@github.com:shonfeder/dune-release.git
[?] Create release 3.3.0 on git@github.com:shonfeder/dune-release.git? [Y/n]
y
[-] Creating release 3.3.0 on git@github.com:shonfeder/dune-release.git via github's API
[+] Successfully created release with id 368790643
[?] Upload _build/dune-release-3.3.0.tbz as release asset? [Y/n]
y
[-] Uploading _build/dune-release-3.3.0.tbz as a release asset for 3.3.0 via github's API
[-] Creating opam package description for dune-release
[+] Wrote opam package description _build/dune-release.3.3.0/opam
main.exe: [WARNING] The repo is dirty. The opam package may be inconsistent
                    with the distribution.
[-] Submitting
[-] Preparing pull request to shonfeder/opam-repository
[-] Fetching https://github.com/shonfeder/opam-repository.git#master
[-] Checking out a local release-dune-release-3.3.0 branch
[-] Pushing release-dune-release-3.3.0 to git@github.com:shonfeder/opam-repository.git
[?] Open PR to shonfeder/opam-repository? [Y/n]
y
[-] Opening pull request to merge branch release-dune-release-3.3.0 of git@github.com:shonfeder/opam-repository.git into shonfeder/opam-repository
↳[0]

producing

I am happy to have this merged. Thanks for the review and the cleanup refactor with the helper function too :)

@Leonidas-from-XIV
Leonidas-from-XIV merged commit ba5bd56 into tarides:main Aug 12, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

publish does not respect --dev-repo

2 participants