diff --git a/CHANGES.md b/CHANGES.md index 811ff14b..cf41185d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,8 @@ - Bump the `ocamlformat` dev dependency to 0.28.1 so that the contributor setup documented in `CONTRIBUTING.md` can be installed again. (#520, @alexleighton) +- `dune-release publish` now respects the `--dev-repo` or `DUNE_RELEASE_DEV_REPO` + CLI inputs. (#522, @shonfeder) ## 2.2.0 diff --git a/lib/github.ml b/lib/github.ml index 5316098c..4088ba28 100644 --- a/lib/github.ml +++ b/lib/github.ml @@ -312,20 +312,28 @@ let create_release ~dry_run ~yes ~dev_repo ~token ~msg ~tag ~version ~user ~repo App_log.status (fun l -> l "Release with id %d already exists" id); Ok id +let repo_info ~dev_repo pkg = + match dev_repo with + | None -> + pkg_dev_repo pkg >>= fun dev_url -> + Pkg.infer_github_repo pkg >>| fun repo -> (dev_url, repo) + | Some dev_url -> ( + match Github_repo.from_uri dev_url with + | None -> + R.error_msgf "the supplied dev-repo %s is not a valid repo URI" + dev_url + | Some repo -> Ok (dev_url, repo)) + let publish_distrib ~token ?dev_repo ~dry_run ~msg ~archive ~yes ~draft ~prerelease p = - Pkg.infer_github_repo p >>= fun { owner; repo } -> Pkg.tag p >>= fun tag -> assert_tag_exists ~dry_run tag >>= fun () -> Vcs.get () >>= fun vcs -> check_tag ~dry_run vcs tag >>= fun () -> - let dev_repo = - match dev_repo with Some d -> Ok d | None -> pkg_dev_repo p - in - dev_repo >>= fun dev_repo -> Pkg.build_dir p >>= fun build_dir -> Pkg.name p >>= fun name -> Pkg.version p >>= fun version -> + repo_info ~dev_repo p >>= fun (dev_repo, { owner; repo }) -> push_tag ~dry_run ~yes ~dev_repo vcs tag >>= fun () -> create_release ~dry_run ~yes ~dev_repo ~token ~version ~msg ~tag ~user:owner ~repo ~draft ~prerelease