4
4
%%NAME%% %%VERSION%%
5
5
---------------------------------------------------------------------------*)
6
6
7
+ open Bos_setup.R.Infix
7
8
open Cmdliner
8
9
9
10
let cmds =
@@ -32,9 +33,13 @@ let man =
32
33
[
33
34
`S Manpage. s_description;
34
35
`P " $(mname) releases dune packages to opam." ;
35
- `P
36
- " Without arguments, $(mname) acts like $(b,dune-release bistro): refer \
37
- to $(b,dune-release help bistro) for help about the default behavior." ;
36
+ `P " The $(mname) command is equivalent to the invokation of:" ;
37
+ `Pre
38
+ " dune-release distrib # Create the distribution archive\n \
39
+ dune-release publish # Publish it on the WWW with its documentation\n \
40
+ dune-release opam pkg # Create an opam package\n \
41
+ dune-release opam submit # Submit it to OCaml's opam repository" ;
42
+ `P " See dune-release(7) for more information." ;
38
43
`P " Use '$(mname) help release' for help to release a package." ;
39
44
`Noblank ;
40
45
`P " Use '$(mname) help troubleshoot' for a few troubleshooting tips." ;
@@ -46,9 +51,37 @@ let man =
46
51
`P " Daniel C. Buenzli, $(i,http://erratique.ch)" ;
47
52
]
48
53
54
+ (* Only carry on when the first operation returns 0 *)
55
+ let ( >! ) x f = match x with Ok 0 -> f () | _ -> x
56
+
57
+ let auto () (`Dry_run dry_run ) (`Package_names pkg_names )
58
+ (`Package_version version ) (`Dist_tag tag ) (`Keep_v keep_v ) (`Token token )
59
+ (`Include_submodules include_submodules ) (`Draft draft )
60
+ (`Local_repo local_repo ) (`Remote_repo remote_repo ) (`Opam_repo opam_repo )
61
+ (`No_auto_open no_auto_open ) =
62
+ Cli. handle_error
63
+ ( Dune_release.Config. token ~token ~dry_run () >> = fun token ->
64
+ let token = Dune_release.Config.Cli. make token in
65
+ Distrib. distrib ~dry_run ~pkg_names ~version ~tag ~keep_v ~keep_dir: false
66
+ ~skip_lint: false ~skip_build: false ~skip_tests: false ~include_submodules
67
+ ()
68
+ > ! fun () ->
69
+ Publish. publish ~token ~pkg_names ~version ~tag ~keep_v ~dry_run
70
+ ~publish_artefacts: [] ~yes: false ~draft ()
71
+ > ! fun () ->
72
+ Opam. get_pkgs ~dry_run ~keep_v ~tag ~pkg_names ~version () >> = fun pkgs ->
73
+ Opam. pkg ~dry_run ~pkgs () > ! fun () ->
74
+ Opam. submit ~token ~dry_run ~pkgs ~pkg_names ~no_auto_open ~yes: false
75
+ ~draft () ?local_repo ?remote_repo ?opam_repo )
76
+
77
+ let cmd =
78
+ Term. (
79
+ pure auto $ Cli. setup $ Cli. dry_run $ Cli. pkg_names $ Cli. pkg_version
80
+ $ Cli. dist_tag $ Cli. keep_v $ Cli. token $ Cli. include_submodules $ Cli. draft
81
+ $ Cli. local_repo $ Cli. remote_repo $ Cli. opam_repo $ Cli. no_auto_open)
82
+
49
83
let main =
50
- ( fst Default. cmd,
51
- Term. info " dune-release" ~version: " %%VERSION%%" ~doc ~sdocs ~exits ~man )
84
+ (cmd, Term. info " dune-release" ~version: " %%VERSION%%" ~doc ~sdocs ~exits ~man )
52
85
53
86
let main () = Term. (exit_status @@ eval_choice main cmds)
54
87
0 commit comments