-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
52 lines (52 loc) · 1.66 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: "GitHub Action for red* OCaml packages"
description: "Workflow shared by all red* OCaml packages for building, testing, and documentation updates"
branding:
icon: "box"
color: "red"
inputs:
ocaml-compiler:
description: "OCaml Compiler Version"
required: true
with-doc:
description: "Whether to build package documentation"
required: false
default: false
publish-doc-if-built:
description: "Whether to publish package documentation"
required: false
default: true
cache-prefix:
description: "The cache-prefix passed to the setup-ocaml action"
required: false
default: "v1"
github-token:
description: "GitHub token"
required: false
default: ${{ github.token }}
runs:
using: "composite"
steps:
- name: "Set up OCaml"
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ inputs.ocaml-compiler }}
cache-prefix: ${{ inputs.cache-prefix }}
- name: "Install the dependencies"
shell: sh
run: opam install --with-test ${{inputs.with-doc == 'true' && '--with-doc' || ''}} --deps-only --yes --verbose .
- name: "Build the package"
shell: sh
run: opam exec -- dune build
- name: "Test the package"
shell: sh
run: opam exec -- dune runtest
- name: "Build the documentation"
if: ${{ inputs.with-doc == 'true' }}
shell: sh
run: opam exec -- dune build @doc
- name: "Publish the documentation"
if: ${{ inputs.with-doc == 'true' && inputs.publish-doc-if-built == 'true' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ inputs.github-token }}
publish_dir: "./_build/default/_doc/_html/"