commit
e3271898b4
3 changed files with 58 additions and 49 deletions
43
ReadMe.md
43
ReadMe.md
|
@ -4,37 +4,50 @@ This action builds the godot project in your `$GITHUB_WORKSPACE`, so that you ca
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
This action will create a `build` folder with subdirectories for linux, windows, and mac. You must have the export preset configured for each platform to successfully export.
|
This action will create a `build` folder an outputed build. You must have the export preset configured for the target platform to successfully export.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: josephbmanley/build-godot-action@master
|
- uses: josephbmanley/build-godot-action@[VERSION]
|
||||||
env:
|
with:
|
||||||
PROJECT: godot-project
|
name: godot-project
|
||||||
SUBDIRECTORY: project
|
preset: HTML5
|
||||||
```
|
```
|
||||||
|
|
||||||
### Environment Variables
|
### Inputs
|
||||||
|
|
||||||
- #### PROJECT **REQUIRED**
|
#### name **required**
|
||||||
|
|
||||||
Name of the project files to output.
|
The name of the exported package/binary
|
||||||
|
|
||||||
Eg. `godot-project` will export to `godot-project.exe`
|
#### preset **required**
|
||||||
|
|
||||||
- #### SUBDIRECTORY
|
The name of the preset found in `export_presets.cfg` you would like to build.
|
||||||
|
|
||||||
Subdirectory to export project into.
|
#### subdirectory
|
||||||
|
|
||||||
Eg. `project` will export to `$GITHUB_WORKSPACE/build/windows/project/godot-project.exe`
|
*Optional*
|
||||||
|
|
||||||
- #### PACKAGE
|
The subdirectory in the `build` folder to output build to, can be useful for self packaging.
|
||||||
|
|
||||||
Boolean value on whether or not to zip game files. Packages will be placed in the `$GITHUB_WORKSPACE/package` directory.
|
#### package
|
||||||
|
|
||||||
|
*Optional*
|
||||||
|
|
||||||
|
Boolean value, when set to true, builds artficat zip file.
|
||||||
|
|
||||||
|
### Outputs
|
||||||
|
|
||||||
|
#### build
|
||||||
|
|
||||||
|
The location the outputed build is placed.
|
||||||
|
|
||||||
|
#### artifact
|
||||||
|
|
||||||
|
The location the outputed artifact is placed.
|
||||||
|
|
||||||
Default Value: `false`
|
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|
18
action.yml
18
action.yml
|
@ -1,9 +1,27 @@
|
||||||
name: "Build Godot"
|
name: "Build Godot"
|
||||||
description: "Build a Godot project for multiple platforms"
|
description: "Build a Godot project for multiple platforms"
|
||||||
author: josephbmanley
|
author: josephbmanley
|
||||||
|
inputs:
|
||||||
|
name:
|
||||||
|
description: 'Name of the exported binary'
|
||||||
|
required: true
|
||||||
|
preset:
|
||||||
|
description: 'Name of the preset in `export_presets.cfg` to use'
|
||||||
|
required: true
|
||||||
|
subdirectory:
|
||||||
|
description: 'Optional name of the subdirectory to put exported project in'
|
||||||
|
required: false
|
||||||
|
package:
|
||||||
|
description: 'Set true to output an artifact zip file'
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: docker
|
using: docker
|
||||||
image: Dockerfile
|
image: Dockerfile
|
||||||
|
args:
|
||||||
|
- ${{ inputs.name }}
|
||||||
|
- ${{ inputs.preset }}
|
||||||
|
- ${{ inputs.subdirectory }}
|
||||||
|
- ${{ inputs.package }}
|
||||||
branding:
|
branding:
|
||||||
icon: loader
|
icon: loader
|
||||||
color: blue
|
color: blue
|
|
@ -2,8 +2,8 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
workDir=`pwd`
|
workDir=`pwd`
|
||||||
platforms="linux windows mac html5"
|
|
||||||
|
|
||||||
|
# Install export templates
|
||||||
wget https://downloads.tuxfamily.org/godotengine/3.1.1/Godot_v3.1.1-stable_export_templates.tpz --quiet
|
wget https://downloads.tuxfamily.org/godotengine/3.1.1/Godot_v3.1.1-stable_export_templates.tpz --quiet
|
||||||
mkdir ~/.cache
|
mkdir ~/.cache
|
||||||
mkdir -p ~/.config/godot
|
mkdir -p ~/.config/godot
|
||||||
|
@ -12,44 +12,22 @@ unzip Godot_v3.1.1-stable_export_templates.tpz
|
||||||
mv templates/* ~/.local/share/godot/templates/3.1.1.stable
|
mv templates/* ~/.local/share/godot/templates/3.1.1.stable
|
||||||
rm -f Godot_v3.1.1-stable_export_templates.tpz
|
rm -f Godot_v3.1.1-stable_export_templates.tpz
|
||||||
|
|
||||||
if [ "${SUBDIRECTORY}" != "" ]
|
if [ "$3" != "" ]
|
||||||
then
|
then
|
||||||
SubDirectoryLocation="${SUBDIRECTORY}/"
|
SubDirectoryLocation="$3/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Export for Linux
|
# Export for project
|
||||||
echo "Building ${PROJECT} for Linux"
|
echo "Building ${PROJECT} for Linux"
|
||||||
mkdir -p ./build/linux/${SubDirectoryLocation:-""}
|
mkdir -p `pwd`/build/${SubDirectoryLocation:-""}
|
||||||
godot --export Linux/X11 ./build/linux/${SubDirectoryLocation:-""}${PROJECT}
|
godot --export $2 `pwd`/build/${SubDirectoryLocation:-""}$1
|
||||||
|
|
||||||
# Export for Windows
|
echo ::set-output name=build::`pwd`/build/${SubDirectoryLocation:-""}
|
||||||
echo "Building ${PROJECT} for Windows"
|
|
||||||
mkdir -p ./build/windows/${SubDirectoryLocation:-""}
|
|
||||||
godot --export "Windows Desktop" ./build/windows/${SubDirectoryLocation:-""}${PROJECT}.exe
|
|
||||||
|
|
||||||
# Export for OSX
|
if [ "$4" = "true" ]
|
||||||
echo "Building ${PROJECT} for OSX"
|
|
||||||
mkdir -p ./build/mac/${SubDirectoryLocation:-""}
|
|
||||||
godot --export "Mac OSX" ./build/mac/${SubDirectoryLocation:-""}${PROJECT}
|
|
||||||
|
|
||||||
# Export for HTML5
|
|
||||||
echo "Building ${PROJECT} for HTML5"
|
|
||||||
mkdir -p ./build/html5/${SubDirectoryLocation:-""}
|
|
||||||
godot --export "HTML5" ./build/html5/${SubDirectoryLocation:-""}index.html
|
|
||||||
|
|
||||||
mkdir ${workDir}/package
|
|
||||||
if [ ${PACKAGE:-"false"} = "true" ]
|
|
||||||
then
|
then
|
||||||
for platform in $platforms
|
mkdir `pwd`/package
|
||||||
do
|
cd `pwd`/build
|
||||||
if [ "$(ls -A ${workDir}/build/${platform})" ]; then
|
zip `pwd`/package/artifact.zip ${SubDirectoryLocation:-"*"} -r
|
||||||
echo $platform
|
echo ::set-output name=artifact::`pwd`/package/artifact.zip
|
||||||
pwd
|
|
||||||
ls
|
|
||||||
cd ${workDir}/build/${platform}
|
|
||||||
zip ${workDir}/package/${PROJECT}-${platform}.zip ${SUBDIRECTORY:-"*"} -r
|
|
||||||
else
|
|
||||||
echo "${platform} did not build!"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
Reference in a new issue