How I upload kaplay games from github to itch.io using github actions
I make games with kaplay.js and this is how I upload my games to itch.io. I do this so I don’t have to constantly zip and reupload files on the page whenever I make an update. The deployment type is webgl.
After you commit and push your game to github, you need to go to your itch.io account
- Go to your itch.io account -> settings -> API Keys
- Generate a new API key. If you already have one, just copy the one you already have. Do NOT share this key with anyone!!! This is as important as your account’s password!!!
While you’re still here over at itch.io
- Upload a new project. Create the name of the project and everything else. You’re gonna need the url in a few mins. I recommend saving the page as a draft. Do not upload any game files here. Leave that blank.
Next go to your github account and to the repo where you have your game
- Go to settings -> secrets & variables -> actions
- Click new repository secret and name your key (in all caps. keep it short. example ITCH_KEY) and paste the itch.io api key.
Then in your code editor when you’re making your game,
- read this guide for a quickstart to github actions
- make a folder .github
- then under .github make a new folder called workflows.
- then under .github/workflows create a file called game_release.yaml (or name it whatever you want)
- copy paste this in there
name: Release
on:
push:
branches:
- main
jobs:
exports:
name: Build, Release, and Upload
runs-on: ubuntu-latest
steps:
- name: Check out repository
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: Zip dist folder
run: zip -r game.zip ./dist
- uses: KikimoraGames/[email protected]
with:
butlerApiKey: ${{secrets.BUTLER_API_KEY}}
gameData: ./game.zip
itchUsername:
itchGameId:
buildChannel: webgl
- replace BUTLER_API_KEY with the name of your key from your github secrets.
- make itchUsername your itch.io username
- make itchGameId the last part of the url for your game’s itch.io page. The id of the url is the stuff after the slash
Do not put any zip files in this repo or it won’t work.
Then commit and push everything to github. In a few mins your game should be published and working. Now everytime you make a change to the code, all you do is commit and push to github and it should update your itch.io page.
Credits to KikimoraGames for providing the github action. You can read more about it here