Commit 6af9c38c authored by Thomas Boni's avatar Thomas Boni
Browse files

add documentation related to apidoc job

parent 733d2f9a
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line
# 🗒 ApiDoc

## Description

Creates a versioned HTML documentation from API annotations in your source
code using [apiDoc](https://www.apidocjs.com/).

## How to use it

1. Prepare your project with API annotations in your source code following
   [apiDoc format](https://apidocjs.com/#examples) and your [apiDoc
   configuration file](https://apidocjs.com/#configuration).
2. Choose a version in [version list](#versions)
3. Add the corresponding URL to your `.gitlab-ci.yml` file (see [Getting
   started](/getting-started)). Example:

    ```yaml
    include:
      - remote: 'https://jobs.go2scale.io/apidoc.yml'
    ```

4. If you need to customize the job (stage, variables, ...) 👉 check the [jobs
   customization](/getting-started/#jobs-customization)
5. Well done, your job is ready to work ! 😀

## Job details

* Job name: `documentation`
* Docker image:
[`node`](https://hub.docker.com/r/_/node)
* Default stage: `build`
* When: `always`

### Variables

| Name | Description | Default |
| ---- | ----------- | ------- |
| `APIDOC_CONFIG_PATH` | Path to config file or to directory containing config file (apidoc.json or apidoc.config.js) | `.` |
| `APIDOC_OUTPUT_PATH` | Output directory path | `/apidoc_build` |
| `APIDOC_TEMPLATE_PATH` | Path to template folder | `/usr/lib/node_modules/apidoc/template/` |
| `DOCUMENTATION_DISABLE` | Disable build | |

### Artifacts

Result of documentation build is [exposed
as](https://docs.gitlab.com/ee/ci/yaml/#artifactsexpose_as) `Documentation` in
merge requests.

## Versions

* **Latest** (current -> `2020-08-07_1`) : `https://jobs.go2scale.io/latest/apidoc.yml`
* **Tag `2020-08-07_1`** : `https://jobs.go2scale.io/2020-08-07_1/apidoc.yml`

    * Initial version
+7 −5
Original line number Diff line number Diff line
@@ -6,16 +6,18 @@ documentation:
    entrypoint: [""]
  stage: build
  variables:
    - APIDOC_CONFIG: ''
    - APIDOC_OUTPUT_PATH: './public'
    - APIDOC_CONFIG_PATH: '.'
    - APIDOC_OUTPUT_PATH: './apidoc_build'
    - APIDOC_TEMPLATE_PATH: '/usr/lib/node_modules/apidoc/template/'
  script:
    - npm install apidoc -g
    - apidoc --verbose -c $APIDOC_CONFIG -o $APIDOC_OUTPUT_PATH
    - npm install apidoc@0.24.0 -g
    - apidoc --verbose -c "$APIDOC_CONFIG_PATH" -o "$APIDOC_OUTPUT_PATH" -t "$APIDOC_TEMPLATE_PATH"
  artifacts:
    when: always
    expose_as: "Documentation"
    paths:
      - public/
      - "$APIDOC_OUTPUT_PATH"
      #  - public/
  rules:
    - if: '$DOCUMENTATION_DISABLE'
      when: never