tools for exporting godot projects via Github Actions
Check if setup has already run without `find`
fixes #8
bendn 2022-12-11
parent a000243 · commit 443f564
-rw-r--r--.github/actions/export-android/action.yml1
-rw-r--r--.github/actions/export/action.yml5
-rw-r--r--.github/actions/setup-godot/action.yml24
-rwxr-xr-x.github/actions/setup-godot/project_path.py4
-rw-r--r--.github/workflows/callable-export.yml2
5 files changed, 23 insertions, 13 deletions
diff --git a/.github/actions/export-android/action.yml b/.github/actions/export-android/action.yml
index 698587e..945734d 100644
--- a/.github/actions/export-android/action.yml
+++ b/.github/actions/export-android/action.yml
@@ -37,6 +37,7 @@ runs:
if: inputs.android-keystore-base64
run: |
echo "::group::Prep build"
+ cd "$PROJECT_PATH"
password="${{ inputs.android-password }}"
echo "${{ inputs.android-keystore-base64 }}" | base64 --decode > ~/release.keystore && echo "Decoded keystore"
alias="$(keytool -storepass "$password" -list -v -keystore ~/release.keystore | grep -E '^Alias name:\s*(.+)$' | cut -d ' ' -f 3-)" && echo "Got alias name"
diff --git a/.github/actions/export/action.yml b/.github/actions/export/action.yml
index 6627e2a..0432fef 100644
--- a/.github/actions/export/action.yml
+++ b/.github/actions/export/action.yml
@@ -30,6 +30,7 @@ runs:
- name: Build
run: |
+ cd "$PROJECT_PATH"
p="${{ inputs.platform }}"
echo "::group::${p^} Build"
export="--export"
@@ -38,7 +39,7 @@ runs:
mkdir -vp build/${{ inputs.platform }}
n="${{ env.NAME }}"
[[ -n "${{ inputs.name }}" ]] && n="${{ inputs.name }}"
- godot -v --headless --path "${{ env.PROJECT_PATH }}" "$export" "${{ steps.n.outputs.export-name }}" "./build/${{ inputs.platform }}/$n.${{ inputs.extension }}"
+ godot -v --headless "$export" "${{ steps.n.outputs.export-name }}" "./build/${{ inputs.platform }}/$n.${{ inputs.extension }}"
echo "::endgroup::"
if [[ -f .github/post_export ]]; then
@@ -52,5 +53,5 @@ runs:
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.platform }}
- path: build/${{ inputs.platform}}
+ path: ${{ env.PROJECT_PATH }}/build/${{ inputs.platform }}
if-no-files-found: error
diff --git a/.github/actions/setup-godot/action.yml b/.github/actions/setup-godot/action.yml
index b0df3d0..1d4db2f 100644
--- a/.github/actions/setup-godot/action.yml
+++ b/.github/actions/setup-godot/action.yml
@@ -4,37 +4,41 @@ description: Setup godot and repo
runs:
using: "composite"
steps:
- - name: Check if clean
- id: clean
+ - name: Check if setup needed
+ id: setup
run: |
- if [[ -z $(find . -mindepth 1 -maxdepth 1) ]]; then echo "clean=true" >> "$GITHUB_OUTPUT";
- else echo "clean=false" >> "$GITHUB_OUTPUT"; fi
+ if [[ ! -d ~/.config/godot ]];
+ then echo "needed=true" >> "$GITHUB_OUTPUT"; echo "::debug::need get deps";
+ else
+ echo "needed=false" >> "$GITHUB_OUTPUT"; echo "::debug::no need get deps";
+ fi
shell: bash
- name: Checkout
- if: steps.clean.outputs.clean == 'true'
+ if: steps.setup.outputs.needed == 'true'
uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
submodules: recursive
+ path: repo
- name: Setup python
- if: steps.clean.outputs.clean == 'true'
+ if: steps.setup.outputs.needed == 'true'
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Setup godot
- if: steps.clean.outputs.clean == 'true'
+ if: steps.setup.outputs.needed == 'true'
run: |
echo "::group::Setup godot"
- wget -q 'https://raw.githubusercontent.com/bend-n/godot-actions/main/.github/actions/setup-godot/parse.py' -O pv.py
# config
mkdir -p ~/.config/godot/
mv /root/.config/godot/editor_settings-3.tres ~/.config/godot/editor_settings-3.tres
- [[ -z $PROJECT_PATH ]] && echo "PROJECT_PATH=." >>$GITHUB_ENV
+ PROJECT_PATH="$(wget -q 'https://raw.githubusercontent.com/bend-n/godot-actions/main/.github/actions/setup-godot/project_path.py' -O - | python - "$PROJECT_PATH")"
+ echo "PROJECT_PATH=$PROJECT_PATH" >>$GITHUB_ENV
cd "$PROJECT_PATH" || true
# create version label thing
@@ -43,7 +47,7 @@ runs:
# templates
TEMPS_DIRNAME="templates"
[[ ${GODOT_VERSION:0:1} -gt 3 ]] && TEMPS_DIRNAME="export_templates"
- VERSION="$(python pv.py "$GODOT_VERSION")"
+ VERSION="$(wget -q 'https://raw.githubusercontent.com/bend-n/godot-actions/main/.github/actions/setup-godot/parse.py' -O - | python - "$GODOT_VERSION")"
TEMPLATES_PATH=".local/share/godot/$TEMPS_DIRNAME/$VERSION"
echo "Putting export templates in $TEMPLATES_PATH."
mkdir -p "$HOME/$TEMPLATES_PATH"
diff --git a/.github/actions/setup-godot/project_path.py b/.github/actions/setup-godot/project_path.py
new file mode 100755
index 0000000..198097c
--- /dev/null
+++ b/.github/actions/setup-godot/project_path.py
@@ -0,0 +1,4 @@
+from os import path
+from sys import argv
+
+print(path.normpath((path.join("repo", argv[1]) if argv[1] else "repo")))
diff --git a/.github/workflows/callable-export.yml b/.github/workflows/callable-export.yml
index cf8526c..19406cc 100644
--- a/.github/workflows/callable-export.yml
+++ b/.github/workflows/callable-export.yml
@@ -24,7 +24,7 @@ on:
required: false
type: string
project-root-path:
- description: the directory that project.godot is in
+ description: the directory that project.godot is in (relative to repo root)
default: "."
required: false
type: string