Skip to content

Commit 9898cb1

Browse files
authored
Merge pull request #500 from tarides/no-docs
Stop publishing docs -- go to ocaml.org instead :-)
2 parents 6d9f26b + 05776c3 commit 9898cb1

File tree

18 files changed

+31
-416
lines changed

18 files changed

+31
-416
lines changed

Diff for: CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
- Use the 'user' option as the fork owner, only attempt to decode the remote URL
1313
if the user option is not set. (#480, @Julow)
14+
- `dune-release` no longer publishes docs to github pages. Instead, we rely on
15+
the docs published under `ocaml.org/packages` (#499 #500, @v-gb @samoht)
1416

1517
### Deprecated
1618

Diff for: README.md

+4-20
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dune-release help # for more help
2727

2828
Calling `dune-release` without any argument will start the automated release process, composed of the following steps:
2929
- create the distribution archive;
30-
- publish it online with its documentation;
30+
- publish it online;
3131
- create an opam package;
3232
- submit it to OCaml's opam repository.
3333

@@ -111,32 +111,16 @@ dune-release help distrib
111111
```
112112

113113

114-
### Publish the distribution and documentation online
114+
### Publish the distribution online
115115

116-
Once the distribution archive is created you can now publish it and its documentation online.
117-
118-
You can publish the archive only with:
116+
Once the distribution archive is created you can now publish it with:
119117

120118
```
121-
dune-release publish distrib
119+
dune-release publish
122120
```
123121

124122
This means creating a Github release associated with the tag and upload the distribution tarball as a release artifact.
125123

126-
You can publish the documentation only with:
127-
128-
```
129-
dune-release publish doc
130-
```
131-
132-
This means publishing the dune generated documentation to `gh-pages` to be served as a static website on github.io.
133-
134-
If neither `distrib` neither `doc` is specified, `dune-release` publishes both:
135-
136-
```
137-
dune-release publish
138-
```
139-
140124
The full documentation of this command is available with
141125
```
142126
dune-release help publish

Diff for: bin/bistro.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ let bistro () (`Dry_run dry_run) (`Package_names pkg_names)
2121
Distrib.distrib ~dry_run ~pkg_names ~version ~tag ~keep_v ~keep_dir
2222
~skip_lint ~skip_build ~skip_tests ~include_submodules ()
2323
>! fun () ->
24-
Publish.publish ~token ~pkg_names ~version ~tag ~keep_v ~dry_run ?dev_repo
25-
~publish_artefacts:[] ~yes:false ~draft ()
24+
Publish.publish ~token ~version ~tag ~keep_v ~dry_run ?dev_repo ~yes:false
25+
~draft ()
2626
>! fun () ->
2727
Opam.get_pkgs ~dry_run ~keep_v ~tag ~pkg_names ~version () >>= fun pkgs ->
2828
Opam.pkg ~dry_run ~pkgs () >! fun () ->
@@ -44,7 +44,7 @@ let man =
4444
`P "The $(tname) command (quick in Russian) is equivalent to invoke:";
4545
`Pre
4646
"dune-release distrib # Create the distribution archive\n\
47-
dune-release publish # Publish it to Github with its documentation\n\
47+
dune-release publish # Publish it to Github\n\
4848
dune-release opam pkg # Create an opam package\n\
4949
dune-release opam submit # Submit it to OCaml's opam repository";
5050
`P "See dune-release(7) for more information.";

Diff for: bin/publish.ml

+13-103
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,6 @@
77
open Bos_setup
88
open Dune_release
99

10-
let gen_doc ~dry_run ~force dir pkg_names =
11-
let names = String.concat ~sep:"," pkg_names in
12-
let build_doc = Cmd.(v "dune" % "build" % "-p" % names % "@doc") in
13-
let doc_dir = Pkg.doc_dir in
14-
let do_doc () = Sos.run ~dry_run ~force build_doc in
15-
R.join @@ Sos.with_dir ~dry_run dir do_doc () >>= fun () ->
16-
Ok Fpath.(dir // doc_dir)
17-
18-
let publish_doc ~dry_run ~yes pkg_names pkg =
19-
App_log.status (fun l -> l "Publishing documentation");
20-
Pkg.distrib_file ~dry_run pkg >>= fun archive ->
21-
Pkg.publish_msg pkg >>= fun msg ->
22-
Archive.untbz ~dry_run ~clean:true archive >>= fun dir ->
23-
OS.Dir.exists dir >>= fun force ->
24-
Pkg.infer_pkg_names dir pkg_names >>= fun pkg_names ->
25-
App_log.status (fun l ->
26-
l "Selected packages: %a"
27-
Fmt.(list ~sep:(any "@ ") (styled `Bold string))
28-
pkg_names);
29-
App_log.status (fun l ->
30-
l "Generating documentation from %a" Text.Pp.path archive);
31-
gen_doc ~dry_run ~force dir pkg_names >>= fun docdir ->
32-
App_log.status (fun l -> l "Publishing to github");
33-
Github.publish_doc ~dry_run ~msg ~docdir ~yes pkg
34-
35-
let pp_field = Fmt.(styled `Bold string)
36-
37-
(* If `publish doc` is invoked explicitly from the CLI, we should fail if the
38-
documentation cannot be published. If it is not called explicitly, we can
39-
skip this step if the `doc` field of the opam file is not set. *)
40-
let publish_doc ~specific ~dry_run ~yes pkg_names pkg =
41-
match Pkg.doc_uri pkg with
42-
| _ when specific -> publish_doc ~dry_run ~yes pkg_names pkg
43-
| Error _ | Ok "" ->
44-
Pkg.name pkg >>= fun name ->
45-
Pkg.opam pkg >>= fun opam ->
46-
App_log.status (fun l ->
47-
l
48-
"Skipping documentation publication for package %s: no %a field in \
49-
%a"
50-
name pp_field "doc" Fpath.pp opam);
51-
Ok ()
52-
| Ok _ -> publish_doc ~dry_run ~yes pkg_names pkg
53-
5410
let publish_distrib ?token ~dry_run ~yes ~draft ?dev_repo pkg =
5511
App_log.status (fun l -> l "Publishing distribution");
5612
Pkg.distrib_file ~dry_run pkg >>= fun archive ->
@@ -63,63 +19,26 @@ let publish_distrib ?token ~dry_run ~yes ~draft ?dev_repo pkg =
6319
Sos.write_file ~dry_run url_file url >>= fun () -> Ok ()
6420

6521
let publish ?build_dir ?opam ?change_log ?distrib_file ?publish_msg ?token
66-
?dev_repo ~pkg_names ~version ~tag ~keep_v ~dry_run ~publish_artefacts ~yes
67-
~draft () =
68-
let specific_doc =
69-
List.exists (function `Doc -> true | _ -> false) publish_artefacts
70-
in
71-
let publish_artefacts =
72-
match publish_artefacts with [] -> [ `Doc; `Distrib ] | v -> v
73-
in
22+
?dev_repo ~version ~tag ~keep_v ~dry_run ~yes ~draft () =
7423
Config.keep_v ~keep_v >>= fun keep_v ->
7524
let pkg =
7625
Pkg.v ~dry_run ?version ?tag ~keep_v ?build_dir ?opam ?change_log
7726
?distrib_file ?publish_msg ()
7827
in
79-
let publish_artefact acc artefact =
80-
acc >>= fun () ->
81-
match artefact with
82-
| `Doc -> publish_doc ~specific:specific_doc ~dry_run ~yes pkg_names pkg
83-
| `Distrib -> publish_distrib ?token ~dry_run ~yes ~draft ?dev_repo pkg
84-
in
85-
List.fold_left publish_artefact (Ok ()) publish_artefacts >>= fun () -> Ok 0
28+
publish_distrib ?token ~dry_run ~yes ~draft ?dev_repo pkg >>= fun () -> Ok 0
8629

87-
let publish_cli () (`Build_dir build_dir) (`Package_names pkg_names)
88-
(`Package_version version) (`Dist_tag tag) (`Keep_v keep_v)
89-
(`Dist_opam opam) (`Change_log change_log) (`Dist_file distrib_file)
90-
(`Publish_msg publish_msg) (`Dry_run dry_run)
91-
(`Publish_artefacts publish_artefacts) (`Yes yes) (`Token token)
92-
(`Draft draft) (`Dev_repo dev_repo) =
30+
let publish_cli () (`Build_dir build_dir) (`Package_version version)
31+
(`Dist_tag tag) (`Keep_v keep_v) (`Dist_opam opam) (`Change_log change_log)
32+
(`Dist_file distrib_file) (`Publish_msg publish_msg) (`Dry_run dry_run)
33+
(`Yes yes) (`Token token) (`Draft draft) (`Dev_repo dev_repo) =
9334
publish ?build_dir ?opam ?change_log ?distrib_file ?publish_msg ?token
94-
~pkg_names ~version ~tag ~keep_v ~dry_run ~publish_artefacts ~yes ~draft
95-
?dev_repo ()
35+
~version ~tag ~keep_v ~dry_run ~yes ~draft ?dev_repo ()
9636
|> Cli.handle_error
9737

9838
(* Command line interface *)
9939

10040
open Cmdliner
10141

102-
let artefacts =
103-
let parser = function
104-
| "do" | "doc" -> `Ok `Doc
105-
| "di" | "dis" | "dist" | "distr" | "distri" | "distrib" -> `Ok `Distrib
106-
| s -> `Error (strf "`%s' unknown publication artefact" s)
107-
in
108-
let printer ppf = function
109-
| `Doc -> Fmt.string ppf "doc"
110-
| `Distrib -> Fmt.string ppf "distrib"
111-
in
112-
let artefact = (parser, printer) in
113-
let doc =
114-
strf
115-
"The artefact to publish. $(docv) must be either `doc` or `distrib`. If \
116-
absent, the set of default publication artefacts is determined by the \
117-
package description."
118-
in
119-
Cli.named
120-
(fun x -> `Publish_artefacts x)
121-
Arg.(value & pos_all artefact [] & info [] ~doc ~docv:"ARTEFACT")
122-
12342
let doc = "Publish package distribution archives and/or documentation."
12443
let sdocs = Manpage.s_common_options
12544
let exits = Cli.exits
@@ -128,29 +47,20 @@ let man_xrefs = [ `Main; `Cmd "distrib" ]
12847
let man =
12948
[
13049
`S Manpage.s_synopsis;
131-
`P "$(mname) $(tname) [$(i,OPTION)]... [$(i,ARTEFACT)]...";
50+
`P "$(mname) $(tname) [$(i,OPTION)]...";
13251
`S Manpage.s_description;
133-
`P
134-
"The $(tname) command publishes package distribution archives and/or \
135-
documentation.";
52+
`P "The $(tname) command publishes package distribution archives.";
13653
`P
13754
"Artefact publication always relies on a distribution archive having \
13855
been generated before with dune-release-distrib(1).";
139-
`S "ARTEFACTS";
140-
`I
141-
( "$(b,distrib)",
142-
"Publishes a distribution archive as part of a Github release." );
143-
`I
144-
( "$(b,doc)",
145-
"Publishes the documentation of a distribution archive to gh-pages." );
14656
]
14757

14858
let term =
14959
Term.(
150-
const publish_cli $ Cli.setup $ Cli.build_dir $ Cli.pkg_names
151-
$ Cli.pkg_version $ Cli.dist_tag $ Cli.keep_v $ Cli.dist_opam
152-
$ Cli.change_log $ Cli.dist_file $ Cli.publish_msg $ Cli.dry_run $ artefacts
153-
$ Cli.yes $ Cli.token $ Cli.draft $ Cli.dev_repo)
60+
const publish_cli $ Cli.setup $ Cli.build_dir $ Cli.pkg_version
61+
$ Cli.dist_tag $ Cli.keep_v $ Cli.dist_opam $ Cli.change_log $ Cli.dist_file
62+
$ Cli.publish_msg $ Cli.dry_run $ Cli.yes $ Cli.token $ Cli.draft
63+
$ Cli.dev_repo)
15464

15565
let info = Cmd.info "publish" ~doc ~sdocs ~exits ~man ~man_xrefs
15666
let cmd = Cmd.v info term

Diff for: bin/publish.mli

+3-7
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,18 @@ val publish :
1414
?publish_msg:string ->
1515
?token:string Dune_release.Config.Cli.t ->
1616
?dev_repo:string ->
17-
pkg_names:string list ->
1817
version:Dune_release.Version.t option ->
1918
tag:Dune_release.Vcs.Tag.t option ->
2019
keep_v:bool Dune_release.Config.Cli.t ->
2120
dry_run:bool ->
22-
publish_artefacts:[ `Distrib | `Doc ] list ->
2321
yes:bool ->
2422
draft:bool ->
2523
unit ->
2624
(int, Bos_setup.R.msg) result
2725
(** [publish ~build_dir ~opam ~change_log ~distrib_uri ~distrib_file
28-
~publish_msg ~name ~pkg_names ~version ~tag ~keep_v ~dry_run
29-
~publish_artefacts ~yes ~draft ()]
30-
publishes the artefacts [publish_artefacts] of the package built with
31-
[name], [version] and [tag]. Returns the exit code (0 for success, 1 for
32-
failure) or error messages.
26+
~publish_msg ~version ~tag ~keep_v ~dry_run ~yes ~draft ()]
27+
publishes the artefacts of the package built with [version] and [tag].
28+
Returns the exit code (0 for success, 1 for failure) or error messages.
3329
3430
- [keep_v] indicates whether the version is prefixed by 'v'. *)
3531

Diff for: lib/github.ml

-123
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
open Bos_setup
88

99
module D = struct
10-
let user = "${user}"
11-
let dir = Fpath.v "${dir}"
12-
let fetch_head = "${fetch_head}"
1310
let pr_url = "${pr_url}"
1411
let pr_node_id = "${pr_node_id}"
1512
let download_url = "${download_url}"
@@ -36,126 +33,6 @@ module Parse = struct
3633
| _ -> None
3734
end
3835

39-
(* Publish documentation *)
40-
41-
let publish_in_git_branch ~dry_run ~remote ~branch ~name ~version ~docdir ~dir
42-
~yes =
43-
let pp_distrib ppf (name, version) =
44-
Fmt.pf ppf "%a %a" Text.Pp.name name Text.Pp.version version
45-
in
46-
let log_publish_result msg distrib dir =
47-
App_log.success (fun m ->
48-
m "%s %a in directory %a of gh-pages branch" msg pp_distrib distrib
49-
Fpath.pp dir)
50-
in
51-
let delete dir =
52-
if not (Fpath.is_current_dir dir) then Sos.delete_dir ~dry_run dir
53-
else
54-
let delete acc p = acc >>= fun () -> Sos.delete_path ~dry_run p in
55-
let gitdir = Fpath.v ".git" in
56-
let not_git p = not (Fpath.equal p gitdir) in
57-
OS.Dir.contents dir >>= fun files ->
58-
List.fold_left delete (Ok ()) (List.filter not_git files)
59-
in
60-
let replace_dir_and_push docdir dir =
61-
let msg = strf "Update %s doc to %a." name Version.pp version in
62-
Vcs.get () >>= fun repo ->
63-
Vcs.run_git_quiet repo ~dry_run ~force:(dir <> D.dir)
64-
Cmd.(v "checkout" % branch)
65-
>>= fun () ->
66-
delete dir >>= fun () ->
67-
Sos.cp ~dry_run ~rec_:true ~force:true ~src:Fpath.(docdir / ".") ~dst:dir
68-
>>= fun () ->
69-
(if dry_run then Ok true else Vcs.is_dirty repo) >>= function
70-
| false -> Ok false
71-
| true ->
72-
Vcs.run_git_quiet repo ~dry_run Cmd.(v "add" % p dir) >>= fun () ->
73-
Vcs.run_git_quiet repo ~dry_run Cmd.(v "commit" % "-m" % msg)
74-
>>= fun () ->
75-
Vcs.run_git_quiet repo ~dry_run Cmd.(v "push") >>= fun () -> Ok true
76-
in
77-
if not (Fpath.is_rooted ~root:Fpath.(v ".") dir) then
78-
R.error_msgf "%a directory is not rooted in the repository or not relative"
79-
Fpath.pp dir
80-
else
81-
let clonedir = Fpath.(parent (parent (parent docdir)) / "gh-pages") in
82-
Sos.delete_dir ~dry_run ~force:true clonedir >>= fun () ->
83-
Vcs.get () >>= fun repo ->
84-
Vcs.clone ~dry_run ~force:true ~dir:clonedir repo >>= fun () ->
85-
Sos.relativize ~src:clonedir ~dst:docdir >>= fun rel_docdir ->
86-
App_log.status (fun l ->
87-
l "Updating local %a branch" Text.Pp.commit "gh-pages");
88-
Sos.with_dir ~dry_run clonedir (replace_dir_and_push rel_docdir) dir
89-
>>= fun res ->
90-
res >>= function
91-
| false (* no changes *) ->
92-
log_publish_result "No documentation changes for" (name, version) dir;
93-
Ok ()
94-
| true ->
95-
let push_spec = strf "%s:%s" branch branch in
96-
Prompt.(
97-
confirm_or_abort ~yes
98-
~question:(fun l ->
99-
l "Push new documentation to %a?" Text.Pp.url
100-
(remote ^ "#gh-pages"))
101-
~default_answer:Yes)
102-
>>= fun () ->
103-
App_log.status (fun l ->
104-
l "Pushing new documentation to %a" Text.Pp.url
105-
(remote ^ "#gh-pages"));
106-
Vcs.run_git_quiet repo ~dry_run Cmd.(v "push" % remote % push_spec)
107-
>>= fun () ->
108-
Sos.delete_dir ~dry_run clonedir >>= fun () ->
109-
log_publish_result "Published documentation for" (name, version) dir;
110-
Ok ()
111-
112-
let publish_doc ~dry_run ~msg:_ ~docdir ~yes p =
113-
Pkg.github_doc_owner_repo_and_path p >>= fun (user, repo, dir) ->
114-
Pkg.name p >>= fun name ->
115-
Pkg.version p >>= fun version ->
116-
let remote = strf "git@@github.com:%s/%s.git" user repo in
117-
Vcs.get () >>= fun vcs ->
118-
let force = user <> D.user in
119-
let create_empty_gh_pages () =
120-
let msg = "Initial commit by dune-release." in
121-
let create () =
122-
Vcs.run_git_quiet vcs ~dry_run Cmd.(v "init") >>= fun () ->
123-
Vcs.run_git_quiet vcs ~dry_run
124-
Cmd.(v "checkout" % "--orphan" % "gh-pages")
125-
>>= fun () ->
126-
Sos.write_file ~dry_run (Fpath.v "README") ""
127-
(* need some file *) >>= fun () ->
128-
Vcs.run_git_quiet vcs ~dry_run Cmd.(v "add" % "README") >>= fun () ->
129-
Vcs.run_git_quiet vcs ~dry_run Cmd.(v "commit" % "README" % "-m" % msg)
130-
in
131-
OS.Dir.with_tmp "gh-pages-%s.tmp"
132-
(fun dir () ->
133-
Sos.with_dir ~dry_run dir create () |> R.join >>= fun () ->
134-
Vcs.run_git_quiet vcs ~dry_run ~force
135-
Cmd.(v "fetch" % Fpath.to_string dir % "gh-pages"))
136-
()
137-
|> R.join
138-
in
139-
(match
140-
Vcs.run_git_quiet vcs ~dry_run ~force Cmd.(v "fetch" % remote % "gh-pages")
141-
with
142-
| Ok () -> Ok ()
143-
| Error _ ->
144-
App_log.status (fun l ->
145-
l "Creating new gh-pages branch with initial commit on %s/%s" user
146-
repo);
147-
create_empty_gh_pages ())
148-
>>= fun () ->
149-
Vcs.run_git_string vcs ~dry_run ~force
150-
Cmd.(v "rev-parse" % "FETCH_HEAD")
151-
~default:(Sos.out D.fetch_head)
152-
>>= fun id ->
153-
Vcs.run_git_quiet vcs ~dry_run ~force
154-
Cmd.(v "branch" % "-f" % "gh-pages" % id)
155-
>>= fun () ->
156-
publish_in_git_branch ~dry_run ~remote ~branch:"gh-pages" ~name ~version
157-
~docdir ~dir ~yes
158-
15936
(* Publish releases *)
16037

16138
let run_with_auth ?(default_body = `Null) ~dry_run Curl.{ url; args; meth } =

0 commit comments

Comments
 (0)