Skip to content

Commit

Permalink
Stop publishing docs -- go to ocaml.org instead :-)
Browse files Browse the repository at this point in the history
  • Loading branch information
samoht committed Feb 3, 2025
1 parent 6d9f26b commit ff68ddc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 96 deletions.
4 changes: 2 additions & 2 deletions bin/bistro.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ let bistro () (`Dry_run dry_run) (`Package_names pkg_names)
Distrib.distrib ~dry_run ~pkg_names ~version ~tag ~keep_v ~keep_dir
~skip_lint ~skip_build ~skip_tests ~include_submodules ()
>! fun () ->
Publish.publish ~token ~pkg_names ~version ~tag ~keep_v ~dry_run ?dev_repo
~publish_artefacts:[] ~yes:false ~draft ()
Publish.publish ~token ~version ~tag ~keep_v ~dry_run ?dev_repo ~yes:false
~draft ()
>! fun () ->
Opam.get_pkgs ~dry_run ~keep_v ~tag ~pkg_names ~version () >>= fun pkgs ->
Opam.pkg ~dry_run ~pkgs () >! fun () ->
Expand Down
103 changes: 11 additions & 92 deletions bin/publish.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,6 @@
open Bos_setup
open Dune_release

let gen_doc ~dry_run ~force dir pkg_names =
let names = String.concat ~sep:"," pkg_names in
let build_doc = Cmd.(v "dune" % "build" % "-p" % names % "@doc") in
let doc_dir = Pkg.doc_dir in
let do_doc () = Sos.run ~dry_run ~force build_doc in
R.join @@ Sos.with_dir ~dry_run dir do_doc () >>= fun () ->
Ok Fpath.(dir // doc_dir)

let publish_doc ~dry_run ~yes pkg_names pkg =
App_log.status (fun l -> l "Publishing documentation");
Pkg.distrib_file ~dry_run pkg >>= fun archive ->
Pkg.publish_msg pkg >>= fun msg ->
Archive.untbz ~dry_run ~clean:true archive >>= fun dir ->
OS.Dir.exists dir >>= fun force ->
Pkg.infer_pkg_names dir pkg_names >>= fun pkg_names ->
App_log.status (fun l ->
l "Selected packages: %a"
Fmt.(list ~sep:(any "@ ") (styled `Bold string))
pkg_names);
App_log.status (fun l ->
l "Generating documentation from %a" Text.Pp.path archive);
gen_doc ~dry_run ~force dir pkg_names >>= fun docdir ->
App_log.status (fun l -> l "Publishing to github");
Github.publish_doc ~dry_run ~msg ~docdir ~yes pkg

let pp_field = Fmt.(styled `Bold string)

(* If `publish doc` is invoked explicitly from the CLI, we should fail if the
documentation cannot be published. If it is not called explicitly, we can
skip this step if the `doc` field of the opam file is not set. *)
let publish_doc ~specific ~dry_run ~yes pkg_names pkg =
match Pkg.doc_uri pkg with
| _ when specific -> publish_doc ~dry_run ~yes pkg_names pkg
| Error _ | Ok "" ->
Pkg.name pkg >>= fun name ->
Pkg.opam pkg >>= fun opam ->
App_log.status (fun l ->
l
"Skipping documentation publication for package %s: no %a field in \
%a"
name pp_field "doc" Fpath.pp opam);
Ok ()
| Ok _ -> publish_doc ~dry_run ~yes pkg_names pkg

let publish_distrib ?token ~dry_run ~yes ~draft ?dev_repo pkg =
App_log.status (fun l -> l "Publishing distribution");
Pkg.distrib_file ~dry_run pkg >>= fun archive ->
Expand All @@ -63,63 +19,26 @@ let publish_distrib ?token ~dry_run ~yes ~draft ?dev_repo pkg =
Sos.write_file ~dry_run url_file url >>= fun () -> Ok ()

let publish ?build_dir ?opam ?change_log ?distrib_file ?publish_msg ?token
?dev_repo ~pkg_names ~version ~tag ~keep_v ~dry_run ~publish_artefacts ~yes
~draft () =
let specific_doc =
List.exists (function `Doc -> true | _ -> false) publish_artefacts
in
let publish_artefacts =
match publish_artefacts with [] -> [ `Doc; `Distrib ] | v -> v
in
?dev_repo ~version ~tag ~keep_v ~dry_run ~yes ~draft () =
Config.keep_v ~keep_v >>= fun keep_v ->
let pkg =
Pkg.v ~dry_run ?version ?tag ~keep_v ?build_dir ?opam ?change_log
?distrib_file ?publish_msg ()
in
let publish_artefact acc artefact =
acc >>= fun () ->
match artefact with
| `Doc -> publish_doc ~specific:specific_doc ~dry_run ~yes pkg_names pkg
| `Distrib -> publish_distrib ?token ~dry_run ~yes ~draft ?dev_repo pkg
in
List.fold_left publish_artefact (Ok ()) publish_artefacts >>= fun () -> Ok 0
publish_distrib ?token ~dry_run ~yes ~draft ?dev_repo pkg >>= fun () -> Ok 0

let publish_cli () (`Build_dir build_dir) (`Package_names pkg_names)
(`Package_version version) (`Dist_tag tag) (`Keep_v keep_v)
(`Dist_opam opam) (`Change_log change_log) (`Dist_file distrib_file)
(`Publish_msg publish_msg) (`Dry_run dry_run)
(`Publish_artefacts publish_artefacts) (`Yes yes) (`Token token)
(`Draft draft) (`Dev_repo dev_repo) =
let publish_cli () (`Build_dir build_dir) (`Package_version version)
(`Dist_tag tag) (`Keep_v keep_v) (`Dist_opam opam) (`Change_log change_log)
(`Dist_file distrib_file) (`Publish_msg publish_msg) (`Dry_run dry_run)
(`Yes yes) (`Token token) (`Draft draft) (`Dev_repo dev_repo) =
publish ?build_dir ?opam ?change_log ?distrib_file ?publish_msg ?token
~pkg_names ~version ~tag ~keep_v ~dry_run ~publish_artefacts ~yes ~draft
?dev_repo ()
~version ~tag ~keep_v ~dry_run ~yes ~draft ?dev_repo ()
|> Cli.handle_error

(* Command line interface *)

open Cmdliner

let artefacts =
let parser = function
| "do" | "doc" -> `Ok `Doc
| "di" | "dis" | "dist" | "distr" | "distri" | "distrib" -> `Ok `Distrib
| s -> `Error (strf "`%s' unknown publication artefact" s)
in
let printer ppf = function
| `Doc -> Fmt.string ppf "doc"
| `Distrib -> Fmt.string ppf "distrib"
in
let artefact = (parser, printer) in
let doc =
strf
"The artefact to publish. $(docv) must be either `doc` or `distrib`. If \
absent, the set of default publication artefacts is determined by the \
package description."
in
Cli.named
(fun x -> `Publish_artefacts x)
Arg.(value & pos_all artefact [] & info [] ~doc ~docv:"ARTEFACT")

let doc = "Publish package distribution archives and/or documentation."
let sdocs = Manpage.s_common_options
let exits = Cli.exits
Expand Down Expand Up @@ -147,10 +66,10 @@ let man =

let term =
Term.(
const publish_cli $ Cli.setup $ Cli.build_dir $ Cli.pkg_names
$ Cli.pkg_version $ Cli.dist_tag $ Cli.keep_v $ Cli.dist_opam
$ Cli.change_log $ Cli.dist_file $ Cli.publish_msg $ Cli.dry_run $ artefacts
$ Cli.yes $ Cli.token $ Cli.draft $ Cli.dev_repo)
const publish_cli $ Cli.setup $ Cli.build_dir $ Cli.pkg_version
$ Cli.dist_tag $ Cli.keep_v $ Cli.dist_opam $ Cli.change_log $ Cli.dist_file
$ Cli.publish_msg $ Cli.dry_run $ Cli.yes $ Cli.token $ Cli.draft
$ Cli.dev_repo)

let info = Cmd.info "publish" ~doc ~sdocs ~exits ~man ~man_xrefs
let cmd = Cmd.v info term
Expand Down
2 changes: 0 additions & 2 deletions bin/publish.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ val publish :
?publish_msg:string ->
?token:string Dune_release.Config.Cli.t ->
?dev_repo:string ->
pkg_names:string list ->
version:Dune_release.Version.t option ->
tag:Dune_release.Vcs.Tag.t option ->
keep_v:bool Dune_release.Config.Cli.t ->
dry_run:bool ->
publish_artefacts:[ `Distrib | `Doc ] list ->
yes:bool ->
draft:bool ->
unit ->
Expand Down

0 comments on commit ff68ddc

Please sign in to comment.