This repository has been archived on 2024-11-15. You can view files and clone it, but cannot push or open issues or pull requests.
build-godot-action/ReadMe.md

194 lines
5.1 KiB
Markdown
Raw Normal View History

2024-04-30 14:32:27 +03:00
![Release Version](https://img.shields.io/github/v/release/krynv/build-godot-action)
2020-02-01 07:05:56 +02:00
![Build Godot Project](logo.png)
2019-11-30 01:32:35 +02:00
This action builds the godot project in your `$GITHUB_WORKSPACE`, so that you can easily automate builds.
Table of Contents:
- [Quickstart](#Quickstart)
- [Usage](#Usage)
- [Contributors](Contributors.md)
## Quickstart
### Step 1: Configure Export Presets
In Godot create export templates for `linux`, `windows`, and `mac`.
The name of the Windows export would be of type `Windows Desktop` and have the name `windows`. For Mac, the name would `mac` and type `Mac OSX`. Then for linux, `Linux/X11`
Once you verify that `export_presets.cfg` is located in the same directory as your `project.godot` file, you can push your changes.
### Step 2: Setup Worfklow on GitHub
Add the following workflow file to your repository. An example file name would be `.github/workflows/build.yml`
```yaml
name: Build Godot Project
on:
push: {}
pull_request: {}
jobs:
Godot:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux, windows, mac]
steps:
2024-04-30 14:17:06 +03:00
- uses: actions/checkout@v4.1.4
with:
lfs: true
- name: Build
id: build
2024-04-30 14:32:27 +03:00
uses: krynv/build-godot-action@v1.0
with:
name: example
preset: ${{ matrix.platform }}
debugMode: "true"
- name: Upload Artifact
2024-04-30 14:17:06 +03:00
uses: actions/upload-artifact@v4
with:
name: Client - ${{ matrix.platform }}
path: ${{ github.workspace }}/${{ steps.build.outputs.build }}
```
#### Workflow Explaination
2020-09-03 07:02:22 +03:00
This workflow has three steps:
- **Checkout**: The Checkout step clones the project on the GitHub actions runner.
- **Build**: This step uses this action to build the Godot project.
- **Upload Artifact**: The Upload Artifact step uploads the output from the build step.
**Matrix Explaination**: The matrix object runs the job for EACH possible value. So in this job, we are using a `platform` matrix to automatically run our workflow for the values `linux`, `windows`, and `mac`.
#### Simple Changes
##### Change Exports
In this workflow, since it's using a matrix you can just add or remove export names from the `platform` matrix. The value being passed MUST have the same name as the preset.
```yaml
Godot:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [win32, win64] # This project will only export using the export presets `win32` and `win64`
```
Additionally if you are not using a matrix, you can set the export preset as the parameter `preset`:
```yaml
- name: Build
id: build
2022-04-27 08:57:29 +03:00
uses: manleydev/build-godot-action@v1.4.1
with:
name: example
preset: win32
```
##### Change Project Name
To change the export name, you can the `name` parameter to whatever you want your project to export as.
```yaml
- name: Build
id: build
2022-04-27 08:57:29 +03:00
uses: manleydev/build-godot-action@v1.4.1
with:
name: test # This project will export with the name "test"
```
##### Disable Debug Mode
This example is set to build with debug mode enable. To disable debug, either set `debugMode` to `false` or remove the field entirely.
```yaml
- name: Build
id: build
2022-04-27 08:57:29 +03:00
uses: manleydev/build-godot-action@v1.4.1
with:
name: example
preset: ${{ matrix.platform }}
debugMode: "false" # This project will not build in debug mode
```
##### Change Project Directory
If your project is located in a subdirectory, you can use the `projectDir` to change build directories.
```yaml
- name: Build
id: build
2022-04-27 08:57:29 +03:00
uses: manleydev/build-godot-action@v1.4.1
with:
name: example
preset: ${{ matrix.platform }}
projectDir: "test" # The project in the `test` directory will be built
```
### Step 3: Test your workflow!
Now, whenever you make a push or pull request in that repository, GitHub Actions will build . You see and download your project in the `Actions` tab of your repository.
2019-11-30 01:32:35 +02:00
## Usage
2019-12-28 23:56:53 +02:00
This action will create a `build` folder an outputed build. You must have the export preset configured for the target platform to successfully export.
2019-11-30 01:34:21 +02:00
2019-11-30 01:32:35 +02:00
Example:
```yaml
steps:
2022-04-27 08:57:29 +03:00
- uses: manleydev/build-godot-action@[VERSION]
2019-12-28 23:56:53 +02:00
with:
name: godot-project
preset: HTML5
2019-11-30 01:32:35 +02:00
```
2019-12-28 23:56:53 +02:00
### Inputs
2019-11-30 01:32:35 +02:00
2019-12-28 23:56:53 +02:00
#### name **required**
2019-11-30 01:32:35 +02:00
2019-12-28 23:56:53 +02:00
The name of the exported package/binary
2019-11-30 01:32:35 +02:00
2019-12-28 23:56:53 +02:00
#### preset **required**
2019-11-30 01:32:35 +02:00
2019-12-28 23:56:53 +02:00
The name of the preset found in `export_presets.cfg` you would like to build.
2019-11-30 06:55:42 +02:00
2019-12-28 23:56:53 +02:00
#### subdirectory
2019-11-30 06:55:42 +02:00
2019-12-28 23:56:53 +02:00
*Optional*
2019-11-30 06:55:42 +02:00
2019-12-28 23:56:53 +02:00
The subdirectory in the `build` folder to output build to, can be useful for self packaging.
2019-12-28 23:56:53 +02:00
#### package
*Optional*
Boolean value, when set to true, builds artficat zip file.
2020-05-04 05:03:30 +03:00
#### projectDir
*Optional*
Directory in workspace containing your godot project.
#### debugMode
*Optional*
Boolean value, when set to true, runs export in debug mode.
2019-12-28 23:56:53 +02:00
### Outputs
#### build
2020-05-04 05:03:30 +03:00
The location the outputed build is placed relative to GitHub Workspace.
2019-12-28 23:56:53 +02:00
#### artifact
2020-05-04 05:03:30 +03:00
The location the outputed artifact is placed relative to GitHub Workspace.