# GitHub Actions


![GitHub release](https://img.shields.io/github/release/likec4/actions.svg)

This action wraps [LikeC4 CLI](/tooling/cli) as a GitHub Action.

<Aside type='tip'>
  Github repository [likec4/template](https://github.com/likec4/template) demonstrates how to deploy to github pages.

  Also check [Deploying to GitHub Pages guide](/guides/deploy-github-pages/) for more details.
</Aside>

### Usage

#### Build website

```yaml
steps:
  - uses: actions/checkout@v4

  - name: ⚙️ build
    uses: likec4/actions@v1
    with:
      action: build
      path: src/likec4
      output: dist
      base: /baseurl/

  - name: upload artifacts
    uses: actions/upload-artifact@v3
    with:
      name: likec4
      path: dist
```


#### Export diagrams to PNG

```yaml
steps:
  - name: export diagrams
    uses: likec4/actions@v1
    with:
      export: png
      path: src/likec4
      output: out/images
      use-dot-bin: 'true'
```

#### Code generation

```yaml
steps:
  - name: code generation
    uses: likec4/actions@v1
    with:
      codegen: react
      output: __generated__/likec4.jsx
```

### Inputs

| Name          | Description                                                                                           |
| ------------- | ----------------------------------------------------------------------------------------------------- |
| `action`      | Action to perform (`build` / `export` / `codegen`)                                                    |
| `export`      | Can be used instead of `action: export`                                                               |
| `codegen`     | Can be used instead of `action: codegen`, same values as in [cli](https://likec4.dev/docs/tools/cli/) |
| `path`        | Path in repository to likec4 sources, root otherwise                                                  |
| `output`      | Output directory/file                                                                                 |
| `base`        | Custom baseUrl for website                                                                            |
| `use-dot-bin` | if `'true'` will use `dot` binary of graphviz                                                         |

> All inputs are optional.  
> By default CLI builds a website to `dist` directory.