From 36ac8f798769615cf25628195faaf474b75a9bc5 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sat, 30 Nov 2019 16:44:28 -0500 Subject: [PATCH] Build zips to ./package directory BUGFIX: spacing . -> * Subdirectory / Subdirectory path Create subdir Echo platform build Conditional zip debug --- Dockerfile | 1 - ReadMe.md | 6 ++++++ entrypoint.sh | 40 +++++++++++++++++++++++++++++++++------- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 57fa098..94ea8a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,6 @@ LABEL "com.github.actions.description"="Build a Godot project for multiple platf LABEL "com.github.actions.icon"="loader" LABEL "com.github.actions.color"="blue" -LABEL version="1.0.0" LABEL repository="https://github.com/josephbmanley/build-godot-action" LABEL homepage="https://cloudsumu.com/" LABEL maintainer="Joseph Manley " diff --git a/ReadMe.md b/ReadMe.md index 2f61534..3270390 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -30,6 +30,12 @@ steps: Eg. `project` will export to `$GITHUB_WORKSPACE/build/windows/project/godot-project.exe` +- #### PACKAGE + + Boolean value on whether or not to zip game files. Packages will be placed in the `$GITHUB_WORKSPACE/package` directory. + + Default Value: `false` + ## Credits This action uses the [godot-ci](https://github.com/aBARICHELLO/godot-ci) docker image from [BARICHELLO](https://github.com/aBARICHELLO) diff --git a/entrypoint.sh b/entrypoint.sh index 6d02d3e..4ade58b 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,8 @@ #!/bin/sh set -e - +workDir=`pwd` +platforms="linux windows mac" wget https://downloads.tuxfamily.org/godotengine/3.1.1/Godot_v3.1.1-stable_export_templates.tpz --quiet mkdir ~/.cache @@ -11,14 +12,39 @@ unzip Godot_v3.1.1-stable_export_templates.tpz mv templates/* ~/.local/share/godot/templates/3.1.1.stable rm -f Godot_v3.1.1-stable_export_templates.tpz +if [ "${SUBDIRECTORY}" != "" ] +then + SubDirectoryLocation="${SUBDIRECTORY}/" +fi + # Export for Linux -mkdir -p ./build/linux -godot --export Linux/X11 ./build/linux/${SUBDIRECTORY:-""}${PROJECT} +echo "Building ${PROJECT} for Linux" +mkdir -p ./build/linux/${SubDirectoryLocation:-""} +godot --export Linux/X11 ./build/linux/${SubDirectoryLocation:-""}${PROJECT} # Export for Windows -mkdir -p ./build/windows -godot --export "Windows Desktop" ./build/windows/${SUBDIRECTORY:-""}${PROJECT}.exe +echo "Building ${PROJECT} for Windows" +mkdir -p ./build/windows/${SubDirectoryLocation:-""} +godot --export "Windows Desktop" ./build/windows/${SubDirectoryLocation:-""}${PROJECT}.exe # Export for OSX -mkdir -p ./builds/mac -godot --export "Mac OSX" ./build/mac/${SUBDIRECTORY:-""}${PROJECT} \ No newline at end of file +echo "Building ${PROJECT} for OSX" +mkdir -p ./builds/mac/${SubDirectoryLocation:-""} +godot --export "Mac OSX" ./build/mac/${SubDirectoryLocation:-""}${PROJECT} + +mkdir ${workDir}/package +if [ ${PACKAGE:-"false"} = "true" ] +then + for platform in $platforms + do + if [ "$(ls -A ${workDir}/build/${platform})" ]; then + echo $platform + pwd + ls + cd ${workDir}/build/${platform} + zip ${workDir}/package/${PROJECT}-${platform}.zip ${SUBDIRECTORY:-"*"} -r + else + echo "${platform} did not build!" + fi + done +fi \ No newline at end of file