tools for exporting godot projects via Github Actions
Diffstat (limited to '.github/actions/setup-godot/action.yml')
-rw-r--r--.github/actions/setup-godot/action.yml73
1 files changed, 60 insertions, 13 deletions
diff --git a/.github/actions/setup-godot/action.yml b/.github/actions/setup-godot/action.yml
index 6df327c..adc143c 100644
--- a/.github/actions/setup-godot/action.yml
+++ b/.github/actions/setup-godot/action.yml
@@ -4,22 +4,69 @@ description: Setup godot and repo
runs:
using: "composite"
steps:
+ - name: Check if setup needed
+ id: setup
+ run: |
+ 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
- uses: actions/checkout@v2
+ if: steps.setup.outputs.needed == 'true'
+ uses: actions/checkout@v3
with:
+ fetch-depth: 0
lfs: true
submodules: recursive
- - name: Setup
+ path: repo
+
+ - name: Setup python
+ if: steps.setup.outputs.needed == 'true'
+ uses: actions/setup-python@v6
+ with:
+ python-version: "3.9"
+
+ - name: Setup godot
+ if: steps.setup.outputs.needed == 'true'
run: |
- BASE_URL="https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}"
- HEADLESS="$BASE_URL/Godot_v${GODOT_VERSION}-${RELEASE}_linux_headless.64.zip"
- TEMPLATES="$BASE_URL/Godot_v${GODOT_VERSION}-${RELEASE}_export_templates.tpz"
- wget -nv "$HEADLESS" -O godot.zip
- wget -nv "$TEMPLATES" -O templates.zip
- mkdir ~/.cache && mkdir -p ~/.config/godot && mkdir -p ~/.local/share/godot/templates/${GODOT_VERSION}.${RELEASE}
- unzip godot.zip && mv "Godot_v${GODOT_VERSION}-${RELEASE}_linux_headless.64" /usr/local/bin/godot
- unzip templates.zip && mv templates/* ~/.local/share/godot/templates/${GODOT_VERSION}.${RELEASE}
- rm godot.zip templates.zip
-
- godot -e -q
+ echo "::group::Setup godot"
+
+ # config
+ mkdir -p ~/.config/godot/
+ mv /root/.config/godot/editor_settings-3.tres ~/.config/godot/editor_settings-3.tres
+ mv /root/.config/godot/editor_settings-4.tres ~/.config/godot/editor_settings-4.tres || true
+ 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
+ git config --global --add safe.directory "$(pwd)" && printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" >version
+
+ # templates
+ TEMPS_DIRNAME="templates"
+ [[ ${GODOT_VERSION:0:1} -gt 3 ]] && TEMPS_DIRNAME="export_templates"
+ 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"
+ if [[ -f /root/templates.tpz ]]; then # brand new container
+ mkdir -p ~/.cache
+ unzip -q /root/templates.tpz -d "$HOME/$TEMPLATES_PATH"
+ else # fallback to the old container method
+ mv "/root/$TEMPLATES_PATH/"* "$HOME/$TEMPLATES_PATH"
+ fi
+ echo -e "Installed templates: $(ls "$HOME/$TEMPLATES_PATH" | tr '\n' ' ')\n"
+
+ # gpm
+ if [[ -f godot.package ]]; then
+ echo "Installing addons via the GPM"
+ wget -q "https://github.com/godot-package-manager/cli/releases/latest/download/godot-package-manager.x86_64" -O gpm
+ chmod +x gpm
+ ./gpm update --cfg-file godot.package --lock-file /dev/null
+ rm gpm
+ fi
+ echo "::endgroup::"
shell: bash