tools for exporting godot projects via Github Actions
configurable project root path
closes #1
bendn 2022-10-09
parent 8a22fae · commit 0b45a78
-rw-r--r--.github/actions/export-android/action.yml11
-rw-r--r--.github/actions/export-linux/action.yml5
-rw-r--r--.github/actions/export-mac/action.yml5
-rw-r--r--.github/actions/export-web/action.yml6
-rw-r--r--.github/actions/export-windows/action.yml5
-rw-r--r--.github/actions/get-export-name/action.yml6
-rw-r--r--.github/actions/setup-godot/action.yml4
-rw-r--r--.github/workflows/callable-export.yml5
8 files changed, 22 insertions, 25 deletions
diff --git a/.github/actions/export-android/action.yml b/.github/actions/export-android/action.yml
index db92eef..87d7ec0 100644
--- a/.github/actions/export-android/action.yml
+++ b/.github/actions/export-android/action.yml
@@ -23,7 +23,6 @@ runs:
platform: Android
- name: Download android sdks
- if: steps.get-export-name.outputs.export-name
run: |
# Generate android keystore and settings
export ANDROID_HOME="/usr/lib/android-sdk"
@@ -41,7 +40,7 @@ runs:
shell: bash
- name: Build (release)
- if: inputs.android-keystore-base64 && steps.get-export-name.outputs.export-name
+ if: inputs.android-keystore-base64
run: |
password="${{ inputs.android-password }}"
echo "::group::Build android (release)"
@@ -49,21 +48,20 @@ runs:
alias=$(keytool -storepass "$password" -list -v -keystore ~/release.keystore | grep -E '^Alias name:\s*(.+)$' | cut -d ' ' -f 3-) && echo "Got alias name"
sed "s@keystore/release=\"\"@keystore/release=\"$HOME/release.keystore\"@g" -i export_presets.cfg && sed 's@keystore/release_user=".*"@keystore/release_user="'$alias'"@g' -i export_presets.cfg && sed 's@keystore/release_password=".*"@keystore/release_password="'$password'"@g' -i export_presets.cfg && echo "Configured export_presets.cfg"
mkdir -p build/android
- godot -v --export "${{steps.get-export-name.outputs.export-name}}" ./build/android/$NAME.apk
+ godot -v --path "${{ env.PROJECT_PATH }}" --export "${{ steps.get-export-name.outputs.export-name }}" "$(realpath ./build/android/${{ env.name }}.apk)"
echo "::endgroup::"
shell: bash
- name: Build (debug)
- if: ${{ ! inputs.android-keystore-base64 && steps.get-export-name.outputs.export-name }}
+ if: ${{ !inputs.android-keystore-base64 }}
run: |
echo "::group::Build android (debug)"
mkdir -p build/android || true
- godot -v --export-debug "${{steps.get-export-name.outputs.export-name}}" ./build/android/$NAME.apk
+ godot -v --path "${{ env.PROJECT_PATH }}" --export-debug "${{ steps.get-export-name.outputs.export-name }}" "$(realpath ./build/android/${{ env.name }}.apk)"
echo "::endgroup::"
shell: bash
- name: Add extra files
- if: steps.get-export-name.outputs.export-name
run: |
if [[ -f .github/post_export ]]; then
chmod +x .github/post_export
@@ -72,7 +70,6 @@ runs:
shell: bash
- name: Upload
- if: steps.get-export-name.outputs.export-name
uses: actions/upload-artifact@v3
with:
name: android
diff --git a/.github/actions/export-linux/action.yml b/.github/actions/export-linux/action.yml
index b79a1a8..163cb5c 100644
--- a/.github/actions/export-linux/action.yml
+++ b/.github/actions/export-linux/action.yml
@@ -14,16 +14,14 @@ runs:
platform: Linux/X11
- name: Linux Build
- if: steps.get-export-name.outputs.export-name
run: |
echo "::group::Linux Build"
mkdir -vp build/linux
- godot -v --export "${{ steps.get-export-name.outputs.export-name }}" ./build/linux/$NAME.x86_64
+ godot -v --path "${{ env.PROJECT_PATH }}" --export "${{ steps.get-export-name.outputs.export-name }}" "$(realpath ./build/linux/${{ env.name }}.x86_64)"
echo "::endgroup::"
shell: bash
- name: Add extra files
- if: steps.get-export-name.outputs.export-name
run: |
if [[ -f .github/post_export ]]; then
chmod +x .github/post_export
@@ -32,7 +30,6 @@ runs:
shell: bash
- uses: actions/upload-artifact@v3
- if: steps.get-export-name.outputs.export-name
with:
name: linux
path: build/linux
diff --git a/.github/actions/export-mac/action.yml b/.github/actions/export-mac/action.yml
index c25788f..5e560b1 100644
--- a/.github/actions/export-mac/action.yml
+++ b/.github/actions/export-mac/action.yml
@@ -14,16 +14,14 @@ runs:
platform: "Mac OSX"
- name: Mac Build
- if: steps.get-export-name.outputs.export-name
run: |
echo "::group::Mac Build"
mkdir -vp build/mac
- godot -v --export "${{ steps.get-export-name.outputs.export-name }}" ./build/mac/$NAME.zip
+ godot -v --path "${{ env.PROJECT_PATH }}" --export "${{ steps.get-export-name.outputs.export-name }}" "$(realpath ./build/mac/${{ env.name }}.zip)"
echo "::endgroup::"
shell: bash
- name: Add extra files
- if: steps.get-export-name.outputs.export-name
run: |
if [[ -f .github/post_export ]]; then
chmod +x .github/post_export
@@ -32,7 +30,6 @@ runs:
shell: bash
- name: Upload
- if: steps.get-export-name.outputs.export-name
uses: actions/upload-artifact@v3
with:
name: mac
diff --git a/.github/actions/export-web/action.yml b/.github/actions/export-web/action.yml
index f8f80d8..f679795 100644
--- a/.github/actions/export-web/action.yml
+++ b/.github/actions/export-web/action.yml
@@ -24,16 +24,14 @@ runs:
platform: HTML5
- name: Web Build
- if: steps.get-export-name.outputs.export-name
run: |
echo "::group::Web Build"
mkdir -vp build/web
- godot -v --export "${{ steps.get-export-name.outputs.export-name }}" ./build/web/index.html
+ godot -v --path "${{ env.PROJECT_PATH }}" --export "${{ steps.get-export-name.outputs.export-name }}" "$(realpath ./build/web/index.html)"
echo "::endgroup::"
shell: bash
- name: Add extra files
- if: steps.get-export-name.outputs.export-name
run: |
if [[ -f .github/post_export ]]; then
chmod +x .github/post_export
@@ -42,14 +40,12 @@ runs:
shell: bash
- name: Upload
- if: steps.get-export-name.outputs.export-name
uses: actions/upload-artifact@v3
with:
name: web
path: build/web
- name: Test git repo
- if: steps.get-export-name.outputs.export-name
id: is-repo
run: "echo ::set-output name=is-repo::$(git rev-parse --is-inside-work-tree || echo false)"
shell: bash
diff --git a/.github/actions/export-windows/action.yml b/.github/actions/export-windows/action.yml
index bff93c0..2163e70 100644
--- a/.github/actions/export-windows/action.yml
+++ b/.github/actions/export-windows/action.yml
@@ -14,18 +14,16 @@ runs:
platform: "Windows Desktop"
- name: Windows Build
- if: steps.get-export-name.outputs.export-name
run: |
echo "::group::Windows Build"
export WINEPREFIX="$HOME/wineprefix"
mkdir "$WINEPREFIX" && chown -R "${USER}:" "$WINEPREFIX"
mkdir -p build/windows
- godot -v --export "${{ steps.get-export-name.outputs.export-name }}" ./build/windows/$NAME.exe
+ godot -v --path "${{ env.PROJECT_PATH }}" --export "${{ steps.get-export-name.outputs.export-name }}" "$(realpath ./build/windows/${{ env.name }}.exe)"
echo "::endgroup::"
shell: bash
- name: Add extra files
- if: steps.get-export-name.outputs.export-name
run: |
if [[ -f .github/post_export ]]; then
chmod +x .github/post_export
@@ -34,7 +32,6 @@ runs:
shell: bash
- name: Upload
- if: steps.get-export-name.outputs.export-name
uses: actions/upload-artifact@v3
with:
name: windows
diff --git a/.github/actions/get-export-name/action.yml b/.github/actions/get-export-name/action.yml
index 1506643..9676426 100644
--- a/.github/actions/get-export-name/action.yml
+++ b/.github/actions/get-export-name/action.yml
@@ -17,7 +17,11 @@ runs:
- name: Get export name
id: get-export-name
run: |
+ cd "${{ env.PROJECT_PATH }}"
wget -nv 'https://raw.githubusercontent.com/bend-n/godot-actions/main/.github/actions/get-export-name/get-export-name.py' -O get-export-name.py
- python get-export-name.py "${{ inputs.platform }}" || echo "::notice file=export_presets.cfg,title=Missing Configuration::No export for ${{ inputs.platform }}."
+ python get-export-name.py "${{ inputs.platform }}" || (
+ echo "::error file=${PROJECT_PATH}/export_presets.cfg,title=Missing Configuration::No export for ${{ inputs.platform }}."
+ exit 1
+ )
echo "::set-output name=export-name::$(python get-export-name.py "${{ inputs.platform }}")"
shell: bash
diff --git a/.github/actions/setup-godot/action.yml b/.github/actions/setup-godot/action.yml
index e37d948..a59dd4c 100644
--- a/.github/actions/setup-godot/action.yml
+++ b/.github/actions/setup-godot/action.yml
@@ -31,6 +31,10 @@ runs:
# config
mkdir -p ~/.config/godot/
mv /root/.config/godot/editor_settings-3.tres ~/.config/godot/editor_settings-3.tres
+ if [[ -z $PROJECT_PATH ]]; then
+ cd "$PROJECT_PATH"
+ echo "PROJECT_PATH=." >> $GITHUB_ENV
+ fi
# create version label thing
git config --global --add safe.directory "$(pwd)" && printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" > version
diff --git a/.github/workflows/callable-export.yml b/.github/workflows/callable-export.yml
index eafc02a..d0f6c4c 100644
--- a/.github/workflows/callable-export.yml
+++ b/.github/workflows/callable-export.yml
@@ -18,6 +18,10 @@ on:
default: "windows linux web android mac"
required: true
type: string
+ project-root-path: # the root folder, relative to your repo, or an absolute path.
+ default: "."
+ required: false
+ type: string
secrets:
android-keystore-base64: # will be filled with andrid debug keystore if left blank
required: false
@@ -28,6 +32,7 @@ on:
env:
GODOT_VERSION: ${{ inputs.godot-version }}
+ PROJECT_PATH: ${{ inputs.project-root-path }}
NAME: ${{ inputs.export-name }}
jobs: