Bash.tv → GitHub → itch.io

← Services · Home

Netlify: Host the Game with Preview Links

Netlify hosts static sites like your game at my-game.netlify.app, with easy custom domains and a separate preview link for each deploy.

   
Cost Free plan with monthly limits on bandwidth and build minutes. Plenty for small games
Upload from Bash / GitHub Actions? ✅ Both, with netlify-cli
Needs a Bash API key? Only to deploy from Bash. GitHub Actions uses its own secret
Good for A clean link, a custom domain, preview links to share for feedback

Part 1: Account and site

  1. Sign up at https://app.netlify.com/signup.
  2. Create an empty site: Add new site → Deploy manually, then drag any small folder in. It gets replaced on the first real deploy.
  3. Site configuration → General → Site details: copy the Site ID (also called API ID). Optionally rename the site, for example my-game → my-game.netlify.app.

Part 2: Create a personal access token

  1. Go to https://app.netlify.com/user/applications#personal-access-tokens.
  2. New access token → name it Bash deploy → choose an expiration → Generate token.
  3. Copy it. It’s only shown once.

Netlify tokens can reach every site on your account, so keep them out of chat.

Part 3a: Deploy from Bash

Add the key in Bash: gear icon → API keys → Any API

Field Value
Address api.netlify.com
Name Netlify
Key your access token
How it’s sent Bearer token
Tips for the bot Netlify token. Site ID <id>. Deploy www/ with netlify deploy --dir=www.

Then ask the bot:

Deploy www/ to Netlify as a preview. (or: “to production”)

The bot runs:

NETLIFY_AUTH_TOKEN=placeholder npx netlify-cli deploy --dir=www --site=<site-id>          # preview link
NETLIFY_AUTH_TOKEN=placeholder npx netlify-cli deploy --dir=www --site=<site-id> --prod   # live site

Part 3b: Deploy from GitHub Actions (on every www/ change)

  1. Repo → Settings → Secrets and variables → Actions
    • Secrets: NETLIFY_AUTH_TOKEN, NETLIFY_SITE_ID
  2. Add .github/workflows/deploy-netlify.yml:
name: Deploy to Netlify
on:
  push:
    branches: [main]
    paths: ["www/**"]
  pull_request:
    paths: ["www/**"]
  workflow_dispatch:
jobs:
  deploy:
    runs-on: ubuntu-latest
    env:
      NETLIFY_AUTH_TOKEN: $
      NETLIFY_SITE_ID: $
    steps:
      - uses: actions/checkout@v4
      - name: Deploy
        if: env.NETLIFY_AUTH_TOKEN != ''
        run: |
          PROD=""; [ "$" = "push" ] && PROD="--prod"
          npx --yes netlify-cli deploy --dir=www --site="$NETLIFY_SITE_ID" $PROD \
            --message "${GITHUB_SHA::7}"

Pushes to main update the live site. Pull requests get a preview link, which shows in the run log.


Troubleshooting

Problem Fix
Unauthorized The token expired or was revoked. Make a new one.
Not Found for the site Check the Site ID, not the site name.
Deployed but not live Without --prod, it’s only a preview link.

Checklist