> For the complete documentation index, see [llms.txt](https://docs.exile.watch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.exile.watch/projects/doryani/actions/preview-deploy-webapp.md).

# Preview deploy webapp

<figure><img src="/files/phOqyIiKbklQTpQi6Q8A" alt="" width="200"><figcaption><p>exile.watch</p></figcaption></figure>

{% hint style="info" %}
This page covers [`preview-deploy-webapp*`](https://github.com/exile-watch/doryani/tree/main/preview-deploy-webapp)actions
{% endhint %}

## Usage

In `.github/workflows/preview-deploy-webapp.yml` paste following snippet:

```yaml
name: "Preview deploy: @exile-watch / doryani"

on:
  pull_request_target:
    types:
      - labeled

jobs:
  preview-deploy-webapp:
    runs-on: ubuntu-latest
    if: contains(github.event.pull_request.labels.*.name, 'preview-deploy')
    steps:
      - name: Preview deploy Crucible to Cloudflare Pages
        uses: exile-watch/doryani/preview-deploy-webapp@main
        with:
          CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          PROJECT_NAME: "crucible"
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          GH_ACTOR: ${{ github.actor }}
          prRef: ${{ github.event.pull_request.head.ref }}
```

## Sub-actions

<table><thead><tr><th width="141" align="center">Action code</th><th width="215">Name</th><th></th></tr></thead><tbody><tr><td align="center"><a href="https://github.com/exile-watch/doryani/blob/main/preview-publish-package/00-create-status-comment/action.yml"><code>00</code></a></td><td>Create status comment</td><td>Creates status comment after <code>preview-deploy</code> label is applied to the branch</td></tr><tr><td align="center"><a href="https://github.com/exile-watch/doryani/blob/main/preview-publish-package/01-publish-prerelease/action.yml"><code>01</code></a></td><td>Preview deploy</td><td>Creates preview deploy at <code>https://{GIT_SHA}.crucible.dev</code></td></tr><tr><td align="center"><a href="https://github.com/exile-watch/doryani/blob/main/preview-publish-package/02-update-status-comment-on-success/action.yml"><code>02</code></a></td><td>Update status comment on success</td><td>Once the webapp is deployed, this action updates the status comment created in <code>00</code></td></tr><tr><td align="center"><a href="https://github.com/exile-watch/doryani/blob/main/preview-publish-package/03-update-status-comment-on-failure/action.yml"><code>03</code></a></td><td>Update status comment on failure</td><td>If <code>00</code> or <code>01</code> action fails, this action updates the status created in <code>00</code></td></tr><tr><td align="center"><a href="https://github.com/exile-watch/doryani/blob/main/preview-publish-package/04-remove-preview-publish-label/action.yml"><code>04</code></a></td><td>Remove preview publish deploy</td><td>Removes <code>preview-deploy</code> label from PR once <code>00</code> is completed</td></tr></tbody></table>
