> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gamavas.fun/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy from GitHub

> Every push to main goes live and every pull request gets its own preview link.

Connect a GitHub repository and stop deploying by hand. GitHub builds your game on its free runners; Gamavas hosts it.

## One click: the Gamavas Edge GitHub App

**1. Connect GitHub**

On your project's page at [gamavas.fun/host](https://gamavas.fun/host), under **Deploy from GitHub**, choose **Connect GitHub** and install the Gamavas Edge app on the repositories you want.

**2. Pick the repository**

Back on the project page, pick the repository and the folder with your built game, for example `dist` or `build/WebGL`. Gamavas suggests one by looking at the repository. Pushes to the default branch, usually `main`, go live.

**3. Merge the pull request**

Gamavas opens a pull request that adds the deploy workflow, and stores a deploy token in the repository's secrets. Merge it, and your next push deploys.

## By hand, with the GitHub Action

Prefer to set it up yourself, or already have a workflow? Use [`Gamavas/deploy-action`](https://github.com/Gamavas/deploy-action).

**1. Make a deploy token**

On your project's page, under **Deploy from GitHub**, make a **deploy token**. Copy it; it's shown once.

**2. Add it to your repository**

In GitHub: **Settings → Secrets and variables → Actions → New repository secret**. Name it `GAMAVAS_DEPLOY_TOKEN` and paste the token.

**3. Add the workflow**

```yaml .github/workflows/deploy.yml theme={"theme":{"light":"github-light","dark":"github-dark"}}
name: Deploy
on:
  push:
    branches: [main]
  pull_request:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # Build your game here (skip if the built files are committed), e.g.
      # - run: npm ci && npm run build
      - uses: Gamavas/deploy-action@v1
        with:
          token: ${{ secrets.GAMAVAS_DEPLOY_TOKEN }}
          dir: dist # the folder with index.html in it
```

| Input | Default | |
| - | - | - |
| `token` | required | The project's deploy token. Keep it in a secret |
| `dir` | `.` | The folder that contains `index.html` |
| `production` | `auto` | `auto`: pushes go live, pull requests are previews. Or `true` / `false` |

The action's outputs are `url` (where the game is now), `preview-url` (this deploy's own address) and `live`.

> [!TIP]
>
> Comment the preview link on pull requests with the `preview-url` output, so reviewers can play the change before it merges.

Revoke a deploy token on the project page if it leaks; workflows using it stop deploying at once.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.