How to use GitHub Actions with your CGE project to get automatic builds

GitHub Actions artifacts

This is now documented in CGE manual about GitHub Actions.

We’ve made it so easy to use GitHub Actions to get automatic builds for your projects, done by GitHub, after every commit. You have to try this 🙂

  1. Download this file: build.yml and place it at .github/workflows/build.yml path in your project. That is, create a subdirectory .github, then subdirectory workflows, then put the build.yml file inside.

    See the sample project castle-game using it.

  2. Then commit, push and just watch the GitHub “Actions” tab as it picks up the commit and automatically rebuilds the project for:

    • Windows (x86_64)
    • Linux (x86_64)
    • Android (APK contains both 32-bit and 64-bit ARM code)
    • macOS (x86_64)

    Ready files are available in the “Artifacts” section. Download them, unpack — ready binary release of your game, for 4 systems above. You don’t need to do builds.

    Note that they will disappear after some time (90 days by default). If you want to preserve them you can e.g. make a GitHub release with them (and maybe even we will automate this too in the future, to make auto-updated “snapshot” release).

The actions execute on GitHub-hosted servers, completely free for open-source projects. They rely on Castle Game Engine Docker image and use the latest CGE “snapshot” revision and latest stable FPC (3.2.2) now. The build is done by executing CGE build tool with proper options. You don’t really need to understand it all — our build.yml just does it for you.

This is my first shot at implementing a new feature in CGE: “Automatic Cloud Builds” that you can quickly turn on when creating new CGE project, and will place a suitable file to integrate your project with

  • Jenkins (your own Jenkins instance, that has to support declarative pipeline and Docker, similar to CGE Jenkins). This implies using a Jenkinsfile like this.

  • GitHub Actions – based on above, this implies using .github/workflows/build.yml.

  • GitLab CI. This means creating a file like .gitlab-ci.yml (example in FPC repo).

1 Like