How I put my game on github pages

I use KAPLAY to make web games and here is how I put those games on github pages.

Step 0: Save all your work in your Github.

Part 1 (in your code editor):


name: Build and Deploy

on:
  push:
    branches:
      - main

jobs: 
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
    - name: Checkout code
      uses: actions/checkout@v4

    - name: Setup Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '20.x'

    - name: Install dependencies
      run: npm install

    - name: Build
      run: npm run build

    - name: Deploy
      uses: peaceiris/actions-gh-pages@v4
      with:
        github_token:  ${{ secrets.GITHUB_TOKEN }} 
        publish_dir: ./dist

Part 2 (in github):

You should then be able to see a link with your game. And that’s it!