DEV Community

Jeremy Kahn
Jeremy Kahn

Posted on

Automating Godot game releases to itch.io

If you're a game developer, you most likely want to spend your time actually designing and developing your game. Unfortunately, a lot of time goes into not-so-interesting manual administrative tasks. One of those tasks is publishing new builds. What if this work could be completely automated away and happen as you work on your game, in the background? With workflow automation tools like GitHub Actions, this is not only possible, but free to use and easy to achieve!

The goal

Me and my friend Luke are building Farmhand Go!, a Godot game that's based around making in-game money by growing and harvesting crops with timed actions. What we wanted was for every merge to the main Git branch to initiate a release to https://rainbowcow-studio.itch.io/farmhand-go, where the game lives and can be played. We also wanted our Discord channel to be automatically notified of the new release as soon as it's available.

With a little elbow grease, we came up with this GitHub Action that does all of this for us:

The rest of this article will discuss how we got this set up, and how you can have something similar for your Godot games!

Prerequisites

In order to set up this automation, you will need your GitHub repo and itch.io page already published. If you want the optional Discord notification functionality, you will need to have your server and relevant channel set up as well.

Setting it up

In the Git repo, your Godot project needs to have an export_presets.cfg file at its root. In Farmhand Go!, the actual Godot project is at ./project rather than the repo root, but your setup may vary. Be sure that export_presets.cfg is not in your .gitignore (it is by default), or that it is at least present for when the actual Godot export occurs. This is what our committed export_presets.cfg looks like:

Once that's set up, you'll need your modified version of the YAML file from above. Here's a more generic version you can use: https://gist.github.com/jeremyckahn/ff4f0e409f089ec36bdecb5a5adb6819. You'll just need to replace the following stubbed values:

  • NAME-OF-YOUR-GAME
  • NAME-OF-YOUR-USER

These occur in a few places in this file, so I recommend using your editor's Find and Replace feature and carefully reviewing the changes. Move this file to your repo's .github/workflows/ directory, and name it whatever you'd like. For Farmhand Go!, it's .github/workflows/deploy.yml.

As written, this automation will run whenever a commit is pushed, either directly or via Pull Request merge, to the main branch. If you want to use a different branch for this automation, change the branches value towards the top of the file.

Once that's in place, you will need an API key for itch.io and optionally a webhook URL for Discord.

The itch.io API key

To create your itch.io API key, go to your settings in itch.io:

Itch.io API key creation step 1

Then, in the left-hand nav, go to "API keys"

Itch.io API key creation step 2

Input your password, and then click "Generate new API key." You should now have a screen that looks something like this:

Itch.io API key creation step 2

And you're done here! Copy the new key and head over to the Settings page for your game's GitHub repo and click on "Secrets" in the left-hand nav:

GitHub secret creation step 1

From here, click "New Repository Secret." For "Name," put BUTLER_API_KEY. For the value, paste in the key that you copied from itch.io. Click "Add secret," and you should now have a screen that looks something like this:

GitHub secret creation step 2

The Discord webhook URL (optional)

In your Discord server, go to "Server Settings":

Discord webhook creation step 1

In the left-hand nav, click "Integrations":

Discord webhook creation step 2

Click "Webhooks:"

Discord webhook creation step 3

Click "New Webhook" and fill out the form appropriately. Here's how ours looks:

Discord webhook creation step 4

Click "Copy Webhook" to copy the URL to your clipboard, and then "Save Changes" at the bottom. We're done here!

Flip back to your GitHub repo's Secrets page, and create a new secret named DISCORD_WEBHOOK with the webhook URL from Discord as the value. Your Secrets page should now look like this:

GitHub secret creation step 3

Now that all the necessary GitHub secrets are in place, all that's left to do is commit .github/workflows/deploy.yml to your main branch via PR. Starting with this commit and going forward on the main branch, all commits will trigger a GitHub Action that deploys your web game to itch.io and notifies your community of the new release:

Successful release deployment

Successful release notification

And that's it! You can customize this workflow to your liking, perhaps by changing the Discord messaging or adding additional build targets. For the latter, I recommend looking at the Action that I learned from in order to see how to support Linux, Mac, and Windows builds: https://github.com/RudyMis/Bubbles/blob/master/.github/workflows/godot-ci.yml

What do you think? How do you think this automation could be improved? Please share your thoughts in the comments. Thanks for reading, and have fun with developing your Godot games!

Top comments (0)