Publish from GitHub

Import a game straight from a GitHub repository and publish it.

看漫畫了解從 GitHub 發布
  1. Asobi「我的遊戲放在 GitHub 上喔」
  2. Ai「只要貼上網址就能匯入!」(github.com/you/my-game)
  3. Asobi「push 之後…」 Ai「就自動變成新版本!」
  4. Asobi「更新紀錄也會從 commit 自動產生耶!」

Import from the site

  1. Open “Publish” and choose the “From GitHub” tab.
  2. Enter the repository URL (https://github.com/you/my-game).
  3. If the game is in a folder of the repository (index.html or package.json is in that folder) or you want a specific branch, set it under “Choose a branch or folder” (for example game or gh-pages).
  4. Press “Next”: the files are imported and you continue to the details screen.
Publish from GitHub
  • index.html in the folder is the entry point. For games that need a build step (Vite, React and so on), see “Games that need a build” below.
  • The repository ZIP can be up to 50 MB, and the game up to 2000 files.
  • Files and folders whose names start with a dot (.env, .github, .gitignore and so on) are not imported.
  • Import again later from “Settings → Versions” and the commit messages since the last import become the changelog. Nothing is imported when there is no new commit (except a version imported as source before Asobiai could build it: it is imported again and built).

Games that need a build (Vite, React and so on)

Projects made with Vite, React, TypeScript and so on don't run in the browser as they are. If package.json has a build script, Asobiai builds the project before publishing it, so you can import the repository as it is (zips and folder uploads work the same way).

  • It runs npm install (npm ci, pnpm or yarn when there is a lockfile) and npm run build, then publishes the dist (build, out) folder. It takes one to three minutes; meanwhile the game page shows that it's building.
  • Updates to a live game stay on the previous version until the build succeeds. If it fails, the log is under Settings → Versions (you also get a notification).
  • Values needed at build time (such as a Supabase URL) go in “Build environment variables” under Settings → Versions, or build_env from AI or the API. They end up in the built files where anyone can read them, so use only public values (names starting with VITE_ and so on).
  • If the repository or zip already has package.json and a dist (build, out) folder, that folder is used without building. When you import without choosing a branch, the gh-pages branch is used if it has the built files.
  • For Supabase, put in only the URL and the publishable (anon) key. Never put a service_role key or other secret keys anywhere.
  • For games that are built, only the build output is served. Asobiai keeps the source for rebuilds and never serves it.
  • A game imported earlier as source (showing a blank screen) is built when you import it again from Settings → Versions.
Build details
  • Builds run on Node.js 22 (.nvmrc and the engines field in package.json are not used).
  • When you choose a folder, the package.json and index.html in that folder are used.
  • Vite projects are built with --base=./ so the files load from any version folder. This overrides base in vite.config.
  • The output is looked for in dist, build and out, then in whichever folder the build made an index.html in. Tests (npm test) are not run.
  • Installing packages and building can take up to 4 minutes each, and the output can be up to 50 MB.
  • Up to 10 builds per hour and 30 per day per account.

To build it yourself, have GitHub Actions build on every push and put the result on the gh-pages branch, then import through the GitHub App with the branch set to gh-pages and “Update automatically on push” checked.

# .github/workflows/build.yml
on:
  push:
    branches: [main]
permissions:
  contents: write
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      # With Vite, --base=./ makes the files load from any folder
      - run: npm run build -- --base=./
        env:
          VITE_SUPABASE_URL: ${{ vars.VITE_SUPABASE_URL }}
      - uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dist

Private repositories

Private repositories work after you install the Asobiai GitHub App. You choose which repositories it can read while installing (read-only; it never writes).

Install the GitHub App

Even from a private repository, the imported folder is served as game files. Make sure it contains nothing secret.

Update automatically on push

For games imported through the GitHub App, check “Update automatically on push” and every push is published as a new version, with the commit messages as the changelog.

  • Without a branch it follows the default branch; with a branch, pushes to that branch. Games pinned to a tag or commit are not updated automatically.
  • Games that need a build are built on every push and released when the build succeeds. If it fails, the previous version stays and you get a notification.
  • You can also update from GitHub Actions without the app (see “From AI or the API” below).

From AI or the API

These fields work with publish_game / update_game over MCP and with the REST API.

github_repoowner/repo or https://github.com/owner/repo (a /tree/<branch>/<folder> URL also works)
github_refBranch, tag or commit (default: the default branch)
github_pathFolder with index.html (and package.json when it is built; default: the whole repository)
github_autoUpdate automatically on push (through the GitHub App only)
sync_githubupdate_game: import the latest commit from the same place again
build_envBuild environment variables { "VITE_…": "…" } (public values only). The response and get_game include build with the build status

REST API example:

sh
curl -X POST https://asobiai.games/api/v1/games \
  -H "Authorization: Bearer asb_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Neon Snake", "github_repo": "you/neon-snake", "github_path": "dist" }'

Updating from GitHub Actions (add ASOBIAI_TOKEN to the repository secrets and ASOBIAI_GAME_ID to its variables). With no new commits it succeeds as “no change”:

yaml
# .github/workflows/asobiai.yml
on:
  push:
    branches: [main]
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - run: |
          curl -fsS -X POST https://asobiai.games/api/v1/games/${{ vars.ASOBIAI_GAME_ID }} \
            -H "Authorization: Bearer ${{ secrets.ASOBIAI_TOKEN }}" \
            -H "Content-Type: application/json" \
            -d '{ "sync_github": true }'