https://medium.com/@artiom.matievschi/unity-3d-ci-cd-pipeline-to-itch-io-22c9a3fa5142
- Introduction
- Creating the pipeline
- Script
In software development, a CI/CD pipeline is an essential tool for managing the building, testing, and deployment of software. In this article, I will guide you through the process of setting up a pipeline that automates the deployment of an Unreal Engine build to Itch.io.
![](/wp-content/uploads/2023/06/0_DqVg5WpETGvL0cRE-1.webp)
To set up the environment for our project, we began by creating a VM in Azure and installing all the necessary tools, including Unity 3d, Git, Git LFS, and the Github Runner. With these tools in place, we created a Github action using a workflow yaml file. This file details each command that must be executed, including downloading the code, compiling, building, and finally, uploading the build to Itch.io.
Creating the Yaml file:
A Github Actions YAML file is a configuration file that defines the workflow of a CI/CD pipeline in Github Actions. It is used to specify the steps that should be executed, along with the conditions under which those steps should be triggered.
For example here is the YAML file created by me:
name: Continious Deployment Unity Prject
run-name: ${{ github.actor }} builds the app
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"
jobs:
Build-and-deploy:
runs-on: self-hosted
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
lfs: "true"
- name: build-Project
run: |
cd CICDscripts
ls
./buildAPK.bat "..\" "..\\Builds\\beeyougames.apk" "Android"
- name: Download Butler
run: |
curl -o butler.zip https://broth.itch.ovh/butler/windows-amd64/LATEST/archive/default
powershell Expand-Archive butler.zip
- name: Publish the build Folder
run: |
./butler/butler.exe push .\Builds beeyougames/beeyou-games-test:android --userversion ${{ github.ref_name }}
env:
BUTLER_API_KEY: ${{ secrets.ITCH_IO_API_KEY }}name: Continious Deployment Unreal Prject
run-name: ${{ github.actor }} builds the app
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"
We define the name of the workflow
name: Continious Deployment Unity PrjectYaY
2. Secondly we give the run A name:
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
![](https://miro.medium.com/v2/resize:fit:875/0*Vhl_9MzyeK4joNDz.png)
3. We specify the conditions under which the actions below will be executed.
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"
“The actions below are executed when a tag is pushed that matches a regular expression, such as the example format of ‘v10.234.4123.52”
4. Under the ‘jobs’ section, you’ll find the actual steps that need to be executed on the host machine running the Github runner.
5. We specify that we should use our self-hosted server since we would definitely require Some tools pre-installed.
runs-on: self-hosted
6. To download the source code, we utilize the prebuilt action ‘checkout’, which handles authentication and downloads all necessary source files. We also specify that the repository is using LFS files in the ‘with’ parameters.
- name: Check out repository code
uses: actions/checkout@v3
with:
lfs: "true"
7. We execute a .bat script that does the actual building of the project
- name: build-Project
run: |
cd CICDscripts
ls
./buildAPK.bat "..\" "..\\Builds\\beeyougames.apk" "Android"
8. We download the Butler tool, which is used by itch.io to publish applications.
- name: Download Butler
run: |
curl -o butler.zip https://broth.itch.ovh/butler/windows-amd64/LATEST/archive/default
powershell Expand-Archive butler.zip
9. We publish the build file using the butler executable downloaded in the previous step
- name: Publish the build Folder
run: |
./butler/butler.exe push .\UnrealProject\Build\Windows matioma/storytellingwithdatatst:win-64 --userversion ${{ github.ref_name }}
env:
BUTLER_API_KEY: ${{ secrets.ITCH_IO_API_KEY }}
9*. We can see that the build step requires an environment variable BUTLER_API_KEY which can retrieve a GitHub secret configured within the Git Repository
BUTLER_API_KEY: ${{ secrets.ITCH_IO_API_KEY }}
Build Script
SET mypath=%~dp0
set projectPath=%1
set outputPath=%2
set buildTarget=%3
call :joinpath %mypath% %projectPath%
set projectPathFull=%Result%
echo %projectPathFull%
call :joinpath %mypath% %logFile%
set logPathFull=%Result%
echo %logPathFull%
call :joinpath %mypath% %outputPath%
set outputPathFull=%Result%
echo %outputPath%
Unity -quit -batchmode -buildTarget Android -projectPath %projectPathFull% -logFile "log.txt" -executeMethod CICDUtils.Builder.BuildProject -outputPath %outputPathFull% -targetPlatform %buildTarget%
:joinpath
set Path1=%~1
set Path2=%~2
if {%Path1:~-1,1%}=={\} (set Result=%Path1%%Path2%) else (set Result=%Path1%\%Path2%)
goto :eof