tools for exporting godot projects via Github Actions
-rw-r--r--.github/FUNDING.yml1
-rw-r--r--.github/ISSUE_TEMPLATE/bug.yml38
-rw-r--r--.github/ISSUE_TEMPLATE/feature.yml17
-rw-r--r--.github/actions/export-android/action.yml72
-rw-r--r--.github/actions/export-linux/action.yml14
-rw-r--r--.github/actions/export-mac/action.yml15
-rw-r--r--.github/actions/export-web/action.yml29
-rw-r--r--.github/actions/export-windows/action.yml17
-rw-r--r--.github/actions/export/action.yml63
-rw-r--r--.github/actions/get-export-name/action.yml27
-rwxr-xr-x.github/actions/get-export-name/get-export-name.py33
-rw-r--r--.github/actions/itch-push/action.yml16
-rw-r--r--.github/actions/setup-godot/action.yml73
-rwxr-xr-x.github/actions/setup-godot/parse.py9
-rwxr-xr-x.github/actions/setup-godot/project_path.py4
-rw-r--r--.github/editor-settings.tres136
-rw-r--r--.github/workflows/callable-export.yml156
-rw-r--r--.gitignore1
-rw-r--r--LICENSE21
-rw-r--r--README.md82
20 files changed, 573 insertions, 251 deletions
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..1bfbcab
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+ko_fi: bendn
diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml
new file mode 100644
index 0000000..e3db58d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug.yml
@@ -0,0 +1,38 @@
+name: Bug Report
+description: File a bug report
+labels: ["bug"]
+assignees:
+ - bendn
+body:
+ - type: markdown
+ attributes:
+ value: Thanks for taking the time to fill out this bug report!
+ - type: textarea
+ attributes:
+ label: What happened?
+ value: "A bug happened!"
+ placeholder: The sky fell!
+ description: Also, what did you expect to happen?
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ render: YAML
+ label: Workflow
+ description: The workflow your using. Please upload the entire workflow, not just a snippet, or "this workflow from here".
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Logs
+ description: The logs generated from the workflow, preferably a link to the run.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Version
+ description: The version that you are using. Use a hash or a branch name.
+ placeholder: main
+ value: main
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml
new file mode 100644
index 0000000..425ac6e
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature.yml
@@ -0,0 +1,17 @@
+name: Feature Request
+description: Request a new feature
+labels: ["enhancement"]
+assignees:
+ - bendn
+body:
+ - type: markdown
+ attributes:
+ value: Thanks for taking the time to request a new feature!
+ - type: textarea
+ attributes:
+ label: What would you like to see changed/added?
+ description: Give some examples to make it clear!
+ placeholder: Cool thing!
+ value: "A rocketship that goes to the moon when you press `a`"
+ validations:
+ required: true
diff --git a/.github/actions/export-android/action.yml b/.github/actions/export-android/action.yml
index 2b8c8c1..945734d 100644
--- a/.github/actions/export-android/action.yml
+++ b/.github/actions/export-android/action.yml
@@ -13,57 +13,41 @@ inputs:
runs:
using: composite
steps:
- - name: Setup godot
+ - name: Setup
uses: bend-n/godot-actions/.github/actions/setup-godot@main
- - name: Setup android sdk
+ - name: Download android sdks
run: |
- sudo apt-get update && sudo apt-get install -y adb openjdk-11-jdk-headless ca-certificates python python-openssl
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
+ # Generate android keystore and settings
export ANDROID_HOME="/usr/lib/android-sdk"
- wget -nv https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip -O tools.zip
- sudo mkdir -pv "$ANDROID_HOME"
- sudo unzip tools.zip -d "$ANDROID_HOME/cmdline-tools" && rm tools.zip
- PATH="${ANDROID_HOME}/cmdline-tools/cmdline-tools/bin:${PATH}"
- yes | sdkmanager --licenses >/dev/null
- sudo sdkmanager "platform-tools" "build-tools;30.0.3" "platforms;android-29" "cmdline-tools;latest" "cmake;3.10.2.4988404" "ndk;21.4.7075529"
-
- shell: bash
-
- - name: Setup editor settings
- run: |
- mkdir -vp ~/.config/godot
- curl 'https://raw.githubusercontent.com/bend-n/godot-actions/main/.github/editor-settings.tres' --output ~/.config/godot/editor_settings-3.tres
-
- # debug keystore is needed for release build /shrug
- keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999 && mv debug.keystore ~/debug.keystore
- sed "s@export/android/debug_keystore = \"\"@export/android/debug_keystore = \"$HOME/debug.keystore\"@" -i ~/.config/godot/editor_settings-3.tres
- shell: bash
-
- - name: Build (release)
- if: ${{ inputs.android-keystore-base64 }}
- run: |
- echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > ~/release.keystore
- ANDROID_KEYSTORE_USER=$(keytool -storepass "$ANDROID_KEYSTORE_PASSWORD" -list -v -keystore ~/release.keystore | grep -E '^Alias name:\s*(.+)$' | cut -d ' ' -f 3-)
- sed "s@keystore/release=\"\"@keystore/release=\"$HOME/release.keystore\"@g" -i export_presets.cfg
- sed 's@keystore/release_user=".*"@keystore/release_user="'$ANDROID_KEYSTORE_USER'"@g' -i export_presets.cfg
- sed 's@keystore/release_password=".*"@keystore/release_password="'$ANDROID_KEYSTORE_PASSWORD'"@g' -i export_presets.cfg
- mkdir -vp build/android
- godot -v --export "Android" ./build/android/$NAME.apk
- env:
- ANDROID_KEYSTORE_BASE64: ${{ inputs.android-keystore-base64 }}
- ANDROID_KEYSTORE_PASSWORD: ${{ inputs.android-password }}
+ export PATH="${ANDROID_HOME}/cmdline-tools/cmdline-tools/bin:${PATH}"
+ if [[ ! -d ${ANDROID_HOME}/cmdline-tools ]]; then
+ echo "::group::Download Android SDKs"
+ mkdir -p ${ANDROID_HOME}/cmdline-tools
+ keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore /root/debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999
+ wget -q https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip -O ~/tools.zip
+ unzip -q ~/tools.zip -d ${ANDROID_HOME}/cmdline-tools && rm ~/tools.zip && echo "Installed command line tools"
+ yes | sdkmanager --licenses >/dev/null && echo "Accepted licenses"
+ sdkmanager "platform-tools" "build-tools;30.0.3" "platforms;android-29" "cmdline-tools;latest" "cmake;3.10.2.4988404" "ndk;21.4.7075529" >/dev/null && echo "Installed Android SDKs"
+ echo "::endgroup::"
+ fi
shell: bash
- - name: Build (debug)
- if: ${{ inputs.android-keystore-base64 }} == ""
+ - name: Prep build
+ if: inputs.android-keystore-base64
run: |
- mkdir -vp build/android || true
- godot -v --export-debug "Android" ./build/android/$NAME.apk
+ 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"
+ 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"
+ echo "::endgroup::"
shell: bash
- - name: Upload
- uses: actions/upload-artifact@v1
+ - name: Build
+ uses: bend-n/godot-actions/.github/actions/export@main
with:
- name: android
- path: build/android
+ debug: ${{ inputs.android-keystore-base64 }}
+ extension: apk
+ platform: android
diff --git a/.github/actions/export-linux/action.yml b/.github/actions/export-linux/action.yml
index be36a1b..382e2df 100644
--- a/.github/actions/export-linux/action.yml
+++ b/.github/actions/export-linux/action.yml
@@ -4,16 +4,8 @@ description: Linux export
runs:
using: composite
steps:
- - name: Setup
- uses: bend-n/godot-actions/.github/actions/setup-godot@main
-
- name: Build
- run: |
- mkdir -vp build/linux
- godot -v --export "Linux" ./build/linux/$NAME.x86_64
- shell: bash
-
- - uses: actions/upload-artifact@v1
+ uses: bend-n/godot-actions/.github/actions/export@main
with:
- name: linux
- path: build/linux
+ extension: x86_64
+ platform: linux
diff --git a/.github/actions/export-mac/action.yml b/.github/actions/export-mac/action.yml
index fa88643..9a702ac 100644
--- a/.github/actions/export-mac/action.yml
+++ b/.github/actions/export-mac/action.yml
@@ -4,17 +4,8 @@ description: Mac export
runs:
using: composite
steps:
- - name: Setup
- uses: bend-n/godot-actions/.github/actions/setup-godot@main
-
- name: Build
- run: |
- mkdir -vp build/mac
- godot -v --export "Mac" ./build/mac/$NAME.zip
- shell: bash
-
- - name: Upload
- uses: actions/upload-artifact@v1
+ uses: bend-n/godot-actions/.github/actions/export@main
with:
- name: mac
- path: build/mac
+ extension: app
+ platform: mac
diff --git a/.github/actions/export-web/action.yml b/.github/actions/export-web/action.yml
index 74111d5..67ef917 100644
--- a/.github/actions/export-web/action.yml
+++ b/.github/actions/export-web/action.yml
@@ -10,30 +10,33 @@ inputs:
description: Email of commiter
required: true
default: "[email protected]"
+ github-pages:
+ description: To gh pages, or not to gh pages, that is the question.
+ required: true
+ default: "true"
runs:
using: composite
steps:
- - name: Setup
- uses: bend-n/godot-actions/.github/actions/setup-godot@main
-
- name: Build
- run: |
- mkdir -vp build/web
- godot -v --export "HTML" ./build/web/index.html
- shell: bash
-
- - name: Upload
- uses: actions/upload-artifact@v1
+ uses: bend-n/godot-actions/.github/actions/export@main
with:
- name: web
- path: build/web
+ name: index
+ extension: html
+ platform: web
+
+ - name: Test git repo
+ id: is-repo
+ run: echo "is-repo=$(git rev-parse --is-inside-work-tree || echo false)" >> "$GITHUB_OUTPUT"
+ shell: bash
- name: Deploy
- uses: JamesIves/github-pages-deploy-action@releases/v4
+ if: steps.is-repo.outputs.is-repo == 'true' && inputs.github-pages == 'true'
+ uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build/web
git-config-name: ${{ inputs.git-name }}
git-config-email: ${{ inputs.git-email }}
single-commit: true
+ silent: true
diff --git a/.github/actions/export-windows/action.yml b/.github/actions/export-windows/action.yml
index c5e0cf3..95aec58 100644
--- a/.github/actions/export-windows/action.yml
+++ b/.github/actions/export-windows/action.yml
@@ -4,17 +4,8 @@ description: "Windows export"
runs:
using: "composite"
steps:
- - name: Setup
- uses: bend-n/godot-actions/.github/actions/setup-godot@main
-
- - name: Windows Build
- run: |
- mkdir -vp build/windows
- godot -v --export "Windows" ./build/windows/$NAME.exe
- shell: bash
-
- - name: Upload
- uses: actions/upload-artifact@v1
+ - name: Build
+ uses: bend-n/godot-actions/.github/actions/export@main
with:
- name: windows
- path: build/windows
+ extension: exe
+ platform: windows
diff --git a/.github/actions/export/action.yml b/.github/actions/export/action.yml
new file mode 100644
index 0000000..52ccc5c
--- /dev/null
+++ b/.github/actions/export/action.yml
@@ -0,0 +1,63 @@
+name: Export
+description: exports
+
+inputs:
+ platform:
+ description: The platform (web, linux, mac, android)
+ required: true
+ extension:
+ description: File extension (x86_64, exe, etc)
+ required: true
+ debug:
+ description: Debug build or no (empty string = debug)
+ required: false
+ default: "false"
+ name:
+ description: The name ($name.exe) # defaults to $NAME
+ required: false
+
+runs:
+ using: composite
+ steps:
+ - name: Setup
+ uses: bend-n/godot-actions/.github/actions/setup-godot@main
+
+ - name: Get export name
+ id: n
+ uses: bend-n/godot-actions/.github/actions/get-export-name@main
+ with:
+ platform: ${{ inputs.platform }}
+
+ - name: Build
+ run: |
+ if [[ -f .github/pre_export ]]; then
+ echo "::group::Run pre export script"
+ chmod +x .github/pre_export
+ ./.github/pre_export ${{ inputs.platform }}
+ echo "::endgroup::"
+ fi
+ cd "$PROJECT_PATH"
+ p="${{ inputs.platform }}"
+ echo "::group::${p^} Build"
+ export="--export"
+ [[ ${GODOT_VERSION:0:1} -gt 3 ]] && export="--export-release"
+ [[ -z $debug ]] && export="--export-debug"
+ mkdir -vp build/${{ inputs.platform }}
+ n="${{ env.NAME }}"
+ [[ -n "${{ inputs.name }}" ]] && n="${{ inputs.name }}"
+ timeout 30m godot -v --headless "$export" "${{ steps.n.outputs.export-name }}" "./build/${{ inputs.platform }}/$n.${{ inputs.extension }}"
+ echo "::endgroup::"
+
+ if [[ -f .github/post_export ]]; then
+ echo "::group::Run post export script"
+ chmod +x .github/post_export
+ ./.github/post_export ${{ inputs.platform }}
+ echo "::endgroup::"
+ fi
+ shell: bash
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: ${{ inputs.platform }}
+ path: ${{ env.PROJECT_PATH }}/build/${{ inputs.platform }}
+ if-no-files-found: error
diff --git a/.github/actions/get-export-name/action.yml b/.github/actions/get-export-name/action.yml
new file mode 100644
index 0000000..2cec900
--- /dev/null
+++ b/.github/actions/get-export-name/action.yml
@@ -0,0 +1,27 @@
+name: "Get the export name for a platform"
+description: "Get the export name for a platform, from the export_presets.cfg"
+
+inputs:
+ platform:
+ description: "The platform to get the export name for"
+ required: true
+
+outputs:
+ export-name:
+ value: ${{ steps.get-export-name.outputs.export-name }}
+ description: "The export name for the platform"
+
+runs:
+ using: "composite"
+ steps:
+ - 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 "${GODOT_VERSION:0:1}" "${{ inputs.platform }}" >/dev/null || (
+ echo "::error file=${PROJECT_PATH}/export_presets.cfg,title=Missing Configuration::No export for ${{ inputs.platform }}."
+ exit 1
+ )
+ echo "export-name=$(python get-export-name.py "${GODOT_VERSION:0:1}" "${{ inputs.platform }}")" >> "$GITHUB_OUTPUT"
+ shell: bash
diff --git a/.github/actions/get-export-name/get-export-name.py b/.github/actions/get-export-name/get-export-name.py
new file mode 100755
index 0000000..7fcbd77
--- /dev/null
+++ b/.github/actions/get-export-name/get-export-name.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+
+import re
+import sys
+
+map = {
+ 3: {
+ "android": "Android",
+ "linux": "Linux/X11",
+ "mac": "Mac OSX",
+ "web": "HTML5",
+ "windows": "Windows Desktop",
+ },
+ 4: {
+ "android": "Android",
+ "linux": "Linux/X11",
+ "mac": "macOS",
+ "web": "Web",
+ "windows": "Windows Desktop",
+ }
+}
+
+platform = f'{map[int(sys.argv[1])][sys.argv[2]]}'
+
+with open('export_presets.cfg', "r") as f:
+ export_presets = f.read()
+ regex = r'\[preset.[0-9]+\]\n+name="(.+)"\n+platform="%s"' % platform
+ matches = re.search(
+ regex, export_presets)
+ if matches:
+ print(matches.groups()[0])
+ else:
+ sys.exit(1)
diff --git a/.github/actions/itch-push/action.yml b/.github/actions/itch-push/action.yml
index 4b84f0e..18f2346 100644
--- a/.github/actions/itch-push/action.yml
+++ b/.github/actions/itch-push/action.yml
@@ -8,7 +8,6 @@ inputs:
itch-path:
description: "The path to the itch.io project eg: leafo/x-moon"
required: false
- default: ""
runs:
using: composite
@@ -21,17 +20,18 @@ runs:
- name: Push
run: |
- [[ -z $ITCH_PATH ]] && ITCH_PATH=bendn/$NAME
function push() {
channel=$1
- [[ $channel == mac ]] && echo -e "#!/bin/bash\n"'cd "$(dirname "$0")"||exit;xattr -cr "$(pwd)/$NAME.app";open -n -a "$(pwd)/$NAME.app"' >./mac/run.sh
- chmod +x **; to_push="$channel"
- [[ $(find $channel -type f | wc -l) -eq 1 && $channel != "android" ]] && to_push="$(echo $(basename $channel/*) .7z | tr -d " ")" && (cd "$channel" && 7z a -mtm=off -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on "../$to_push" ./*)
- butler push "$to_push" "$ITCH_PATH:$channel"
+ [[ ! -d $channel ]] && return 0
+ echo "::group::Push $channel"
+ chmod +x "$channel/"*;
+ butler push "$channel" "${{ inputs.itch-path }}:$channel"
+ echo "::endgroup::"
}
- push "web"; push "linux"; push "windows"; unzip "mac/$NAME.zip" -d mac/ && rm "mac/$NAME.zip" && push "mac"
+ push "web"; push "linux"; push "windows";
+ [[ -d mac ]] && echo -e '#!/bin/bash\ncd "$(dirname "$0")";\nxattr -cr "$(pwd)/${{ env.NAME }}.app";\nopen -n -a "$(pwd)/${{ env.NAME }}.app"' >./mac/run.sh \
+ && push "mac"
[[ -d android ]] && rm android/*.idsig && push "android"
env:
BUTLER_API_KEY: ${{ inputs.api-key }}
- ITCH_PATH: ${{ inputs.itch-path }}
shell: bash
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
diff --git a/.github/actions/setup-godot/parse.py b/.github/actions/setup-godot/parse.py
new file mode 100755
index 0000000..d53daa0
--- /dev/null
+++ b/.github/actions/setup-godot/parse.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+
+from sys import argv
+
+parsed = argv[1].split(".")
+release = "stable"
+if len(parsed[-1]) > 1:
+ release = parsed.pop(-1)
+print(f"{'.'.join(parsed)}.{release}")
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/editor-settings.tres b/.github/editor-settings.tres
deleted file mode 100644
index e1be72f..0000000
--- a/.github/editor-settings.tres
+++ /dev/null
@@ -1,136 +0,0 @@
-[gd_resource type="EditorSettings" format=2]
-
-[resource]
-text_editor/highlighting/symbol_color = Color( 0.67, 0.785, 1, 1 )
-text_editor/highlighting/keyword_color = Color( 1, 0.44, 0.52, 1 )
-text_editor/highlighting/control_flow_keyword_color = Color( 1, 0.55, 0.8, 1 )
-text_editor/highlighting/base_type_color = Color( 0.26, 1, 0.76, 1 )
-text_editor/highlighting/engine_type_color = Color( 0.556, 1, 0.856, 1 )
-text_editor/highlighting/user_type_color = Color( 0.778, 1, 0.928, 1 )
-text_editor/highlighting/comment_color = Color( 0.8, 0.8075, 0.8275, 0.5 )
-text_editor/highlighting/string_color = Color( 1, 0.925, 0.63, 1 )
-text_editor/highlighting/background_color = Color( 0.125, 0.14375, 0.19375, 1 )
-text_editor/highlighting/completion_background_color = Color( 0.2, 0.23, 0.31, 1 )
-text_editor/highlighting/completion_selected_color = Color( 1, 1, 1, 0.07 )
-text_editor/highlighting/completion_existing_color = Color( 1, 1, 1, 0.14 )
-text_editor/highlighting/completion_scroll_color = Color( 1, 1, 1, 0.07 )
-text_editor/highlighting/completion_font_color = Color( 0.8, 0.8075, 0.8275, 1 )
-text_editor/highlighting/text_color = Color( 0.8, 0.8075, 0.8275, 1 )
-text_editor/highlighting/line_number_color = Color( 0.8, 0.8075, 0.8275, 0.5 )
-text_editor/highlighting/safe_line_number_color = Color( 0.8, 0.969, 0.8275, 0.75 )
-text_editor/highlighting/caret_color = Color( 1, 1, 1, 1 )
-text_editor/highlighting/text_selected_color = Color( 0.1, 0.115, 0.155, 1 )
-text_editor/highlighting/brace_mismatch_color = Color( 1, 0.47, 0.42, 1 )
-text_editor/highlighting/current_line_color = Color( 1, 1, 1, 0.07 )
-text_editor/highlighting/line_length_guideline_color = Color( 0.2, 0.23, 0.31, 1 )
-text_editor/highlighting/word_highlighted_color = Color( 1, 1, 1, 0.07 )
-text_editor/highlighting/number_color = Color( 0.63, 1, 0.88, 1 )
-text_editor/highlighting/function_color = Color( 0.34, 0.7, 1, 1 )
-text_editor/highlighting/member_variable_color = Color( 0.736, 0.88, 1, 1 )
-text_editor/highlighting/mark_color = Color( 1, 0.47, 0.42, 0.3 )
-text_editor/highlighting/breakpoint_color = Color( 1, 0.47, 0.42, 1 )
-text_editor/highlighting/code_folding_color = Color( 1, 1, 1, 0.7 )
-text_editor/highlighting/search_result_color = Color( 1, 1, 1, 0.07 )
-export/android/android_sdk_path = "/usr/lib/android-sdk"
-export/android/debug_keystore = ""
-export/android/debug_keystore_user = "androiddebugkey"
-export/android/debug_keystore_pass = "android"
-export/android/force_system_user = false
-export/android/shutdown_adb_on_exit = true
-export/web/http_host = "localhost"
-export/web/http_port = 8060
-export/web/use_ssl = false
-export/web/ssl_key = ""
-export/web/ssl_certificate = ""
-export/windows/rcedit = ""
-export/windows/osslsigncode = ""
-export/windows/wine = ""
-interface/scene_tabs/always_show_close_button = false
-interface/editor/save_on_focus_loss = false
-interface/editor/show_update_spinner = false
-interface/editor/update_continuously = false
-interface/scene_tabs/restore_scenes_on_load = false
-interface/inspector/capitalize_properties = true
-interface/inspector/default_float_step = 0.001
-interface/inspector/disable_folding = false
-interface/inspector/auto_unfold_foreign_scenes = true
-interface/inspector/horizontal_vector2_editing = false
-interface/inspector/horizontal_vector_types_editing = true
-interface/inspector/open_resources_in_current_inspector = true
-interface/inspector/resources_to_open_in_new_inspector = "Script,MeshLibrary,TileSet"
-interface/inspector/default_color_picker_mode = 0
-_default_feature_profile = ""
-interface/editors/show_scene_tree_root_selection = true
-interface/editors/derive_script_globals_by_name = true
-_use_favorites_root_selection = false
-filesystem/file_server/port = 6010
-filesystem/file_server/password = ""
-editors/3d/manipulator_gizmo_size = 80
-editors/3d/manipulator_gizmo_opacity = 0.9
-editors/3d/navigation/show_viewport_rotation_gizmo = true
-debugger/auto_switch_to_remote_scene_tree = false
-debugger/remote_scene_tree_refresh_interval = 1.0
-debugger/remote_inspect_refresh_interval = 0.2
-debugger/profiler_frame_history_size = 600
-debugger/profiler_frame_max_functions = 512
-text_editor/files/auto_reload_scripts_on_external_change = true
-text_editor/files/auto_reload_and_parse_scripts_on_save = true
-text_editor/files/open_dominant_script_on_scene_change = true
-text_editor/external/use_external_editor = false
-text_editor/external/exec_path = ""
-text_editor/script_list/script_temperature_enabled = true
-text_editor/script_list/highlight_current_script = true
-text_editor/script_list/script_temperature_history_size = 15
-text_editor/script_list/current_script_background_color = Color( 1, 1, 1, 0.3 )
-text_editor/script_list/group_help_pages = true
-text_editor/script_list/sort_scripts_by = 0
-text_editor/script_list/list_script_names_as = 0
-text_editor/external/exec_flags = "{file}"
-asset_library/available_urls = {
-"godotengine.org (Official)": "https://godotengine.org/asset-library/api"
-}
-asset_library/use_threads = true
-editors/grid_map/preview_size = 64
-editors/tile_map/preview_size = 64
-editors/tile_map/palette_item_hseparation = 8
-editors/tile_map/show_tile_names = true
-editors/tile_map/show_tile_ids = false
-editors/tile_map/sort_tiles_by_name = true
-editors/tile_map/bucket_fill_preview = true
-editors/tile_map/editor_side = 1
-editors/tile_map/palette_min_width = 80
-editors/3d_gizmos/gizmo_colors/room_edge = Color( 0.5, 1, 0, 1 )
-editors/3d_gizmos/gizmo_colors/room_overlap = Color( 1, 0, 0, 1 )
-editors/3d_gizmos/gizmo_colors/instanced = Color( 0.7, 0.7, 0.7, 0.6 )
-editors/3d_gizmos/gizmo_colors/portal_margin = Color( 1, 0.1, 0.1, 0.3 )
-editors/3d_gizmos/gizmo_colors/portal_edge = Color( 0, 0, 0, 0.3 )
-editors/3d_gizmos/gizmo_colors/portal_arrow = Color( 1, 1, 1, 1 )
-editors/3d_gizmos/gizmo_colors/occluder = Color( 1, 0, 1, 1 )
-editors/3d_gizmos/gizmo_colors/path = Color( 0.5, 0.5, 1, 0.8 )
-editors/3d_gizmos/gizmo_colors/csg = Color( 0, 0.4, 1, 0.15 )
-editors/grid_map/editor_side = 1
-editors/grid_map/palette_min_width = 230
-network/language_server/remote_host = "127.0.0.1"
-network/language_server/remote_port = 6008
-network/language_server/enable_smart_resolve = true
-network/language_server/show_native_symbols_in_editor = false
-network/language_server/use_thread = false
-editors/3d_gizmos/gizmo_colors/camera = Color( 0.8, 0.4, 0.8, 1 )
-editors/3d_gizmos/gizmo_colors/stream_player_3d = Color( 0.4, 0.8, 1, 1 )
-editors/3d_gizmos/gizmo_colors/shape = Color( 0.5, 0.7, 1, 1 )
-editors/3d_gizmos/gizmo_colors/skeleton = Color( 1, 0.8, 0.4, 1 )
-editors/3d_gizmos/gizmo_colors/visibility_notifier = Color( 0.8, 0.5, 0.7, 1 )
-editors/3d_gizmos/gizmo_colors/particles = Color( 0.8, 0.7, 0.4, 1 )
-editors/3d_gizmos/gizmo_colors/reflection_probe = Color( 0.6, 1, 0.5, 1 )
-editors/3d_gizmos/gizmo_colors/gi_probe = Color( 0.5, 1, 0.6, 1 )
-editors/3d_gizmos/gizmo_colors/baked_indirect_light = Color( 0.5, 0.6, 1, 1 )
-editors/3d_gizmos/gizmo_colors/navigation_edge = Color( 0.5, 1, 1, 1 )
-editors/3d_gizmos/gizmo_colors/navigation_edge_disabled = Color( 0.7, 0.7, 0.7, 1 )
-editors/3d_gizmos/gizmo_colors/navigation_solid = Color( 0.5, 1, 1, 0.4 )
-editors/3d_gizmos/gizmo_colors/navigation_solid_disabled = Color( 0.7, 0.7, 0.7, 0.4 )
-editors/3d_gizmos/gizmo_colors/joint = Color( 0.5, 0.8, 1, 1 )
-editors/3d_gizmos/gizmo_colors/joint_body_a = Color( 0.6, 0.8, 1, 1 )
-editors/3d_gizmos/gizmo_colors/joint_body_b = Color( 0.6, 0.9, 1, 1 )
-text_editor/help/sort_functions_alphabetically = true
-text_editor/highlighting/gdscript/function_definition_color = Color( 0.4, 0.9, 1, 1 )
-text_editor/highlighting/gdscript/node_path_color = Color( 0.39, 0.76, 0.35, 1 ) \ No newline at end of file
diff --git a/.github/workflows/callable-export.yml b/.github/workflows/callable-export.yml
new file mode 100644
index 0000000..19406cc
--- /dev/null
+++ b/.github/workflows/callable-export.yml
@@ -0,0 +1,156 @@
+name: "export"
+on:
+ workflow_call:
+ inputs:
+ godot-version:
+ description: the godot version (deprecated, this is now parsed out of the image input)
+ required: false
+ type: string
+ # deprecationMessage: This is parsed out of the image input.
+ # deprecation message doesnt work, done manually.
+ image:
+ description: the container to use
+ default: ghcr.io/bend-n/godot-2d:3.5
+ required: true
+ type: string
+ export-name:
+ description: the name of the exec. ($export-name.exe)
+ default: ${{ github.event.repository.name }}
+ required: false
+ type: string
+ platforms:
+ description: space seperated platform list
+ default: "windows linux web android mac"
+ required: false
+ type: string
+ project-root-path:
+ description: the directory that project.godot is in (relative to repo root)
+ default: "."
+ required: false
+ type: string
+ github-pages:
+ description: to deploy to github pages or not to deploy to github pages
+ default: "true"
+ required: false
+ type: string # shut
+ itch-path:
+ description: "the itch.io path to export to, eg: bendn/chess"
+ default: "${{ github.repository_owner }}/${{ github.event.repository.name }}"
+ required: false
+ type: string
+ secrets:
+ android-keystore-base64:
+ description: For signing the apk, will be filled with andrid debug keystore if left blank
+ required: false
+ android-keystore-password:
+ description: For signing the apk, will be filled with andrid debug keystore if left blank
+ required: false
+ butler-api-key:
+ description: For deploying to itch.io
+ required: false
+
+env:
+ PROJECT_PATH: ${{ inputs.project-root-path }}
+ NAME: ${{ inputs.export-name }}
+
+jobs:
+ deprecation-warn:
+ runs-on: ubuntu-latest
+ if: ${{ inputs.godot-version }}
+ name: Warn for deprecation
+ steps:
+ - name: version deprecation warn
+ if: ${{ inputs.godot-version }}
+ run: echo "::warning title=input.godot-version deprecated::Version now parsed out of input.image"
+
+ linux:
+ runs-on: ubuntu-latest
+ if: contains(inputs.platforms, 'linux')
+ container:
+ image: ${{ inputs.image }}
+ name: Linux
+ steps:
+ - name: Get ver
+ run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV
+
+ - name: Build
+ uses: bend-n/godot-actions/.github/actions/export-linux@main
+
+ windows:
+ runs-on: ubuntu-latest
+ if: contains(inputs.platforms, 'windows')
+ container:
+ image: ${{ inputs.image }}
+ name: Windows
+ steps:
+ - name: Get ver
+ run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV
+
+ - name: Build
+ uses: bend-n/godot-actions/.github/actions/export-windows@main
+
+ mac:
+ runs-on: ubuntu-latest
+ if: contains(inputs.platforms, 'mac')
+ container:
+ image: ${{ inputs.image }}
+ name: macOS
+ steps:
+ - name: Get ver
+ run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV
+
+ - name: Build
+ uses: bend-n/godot-actions/.github/actions/export-mac@main
+
+ web:
+ runs-on: ubuntu-latest
+ if: contains(inputs.platforms, 'web')
+ container:
+ image: ${{ inputs.image }}
+ name: HTML5
+ steps:
+ - name: Get ver
+ run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV
+
+ - name: Build
+ uses: bend-n/godot-actions/.github/actions/export-web@main
+ with:
+ github-pages: ${{ inputs.github-pages }}
+
+ android:
+ runs-on: ubuntu-latest
+ if: contains(inputs.platforms, 'android')
+ container:
+ image: ${{ inputs.image }}
+ name: Android
+ steps:
+ - name: Get ver
+ run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV
+
+ - name: Build
+ uses: bend-n/godot-actions/.github/actions/export-android@main
+ with:
+ android-keystore-base64: ${{ secrets.android-keystore-base64 }}
+ android-password: ${{ secrets.android-keystore-password }}
+
+ push-itch:
+ needs: [linux, android, windows, mac, web]
+ if: always() # run even if the previous jobs were skipped
+ name: Push to itch.io
+ runs-on: ubuntu-20.04
+ steps:
+ - name: check
+ id: secret
+ run: |
+ function output() { echo "secret=$1" >> "$GITHUB_OUTPUT"; }
+ if [[ -n "${{ secrets.butler-api-key }}" ]];
+ then output "true";
+ else output "false";
+ fi
+
+ - name: Push
+ if: steps.secret.outputs.secret == 'true'
+ uses: bend-n/godot-actions/.github/actions/itch-push@main
+ with:
+ api-key: ${{ secrets.butler-api-key }}
+ itch-path: ${{ inputs.itch-path }}
diff --git a/.gitignore b/.gitignore
index 5bbe921..a42800a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
.import/
logs/
*.sh
-*.py
*.pgn
.vscode/
exports/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..9a9763e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 bendn
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a238974
--- /dev/null
+++ b/README.md
@@ -0,0 +1,82 @@
+# godot-actions
+
+[![license](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)](https://github.com/bend-n/godot-actions/blob/main/LICENSE "License")
+[![version](https://img.shields.io/badge/>3.5-blue?logo=godot-engine&logoColor=white&label=godot&style=for-the-badge)](https://godotengine.org)
+<a href='https://ko-fi.com/bendn' title='Buy me a coffee' target='_blank'><img height='28' src='https://storage.ko-fi.com/cdn/brandasset/kofi_button_red.png' alt='Buy me a coffee'> </a>
+
+Github Actions composite action repository.
+
+## How to use
+
+<details open>
+<summary>Snippet</summary>
+
+```yaml
+build-windows:
+ runs-on: ubuntu-latest
+ container:
+ image: ghcr.io/bend-n/godot-2d:3.5
+ name: Build windows
+ steps:
+ - name: Build
+ uses: bend-n/godot-actions/.github/actions/export-windows@main
+ env:
+ NAME: ${{ github.event.repository.name }}
+```
+
+</details>
+
+<details>
+<summary>Full example</summary>
+
+> **Note**
+> This is a copy of [godot-template/.github/workflows/export.yml](https://github.com/bend-n/godot-template/blob/9c9e2b02ddf9f88bff872dcd2695363d09485bc4/.github/workflows/export.yml)
+
+```yaml
+name: "export" # name of the workflow
+on: # when it is triggered
+ workflow_dispatch: # manually or
+ push: # on a push
+ branches:
+ - main # to this branch
+ paths: # with modifications to these files
+ - "**.gd" # all gdscript files
+ - "**.tscn" # scene files
+ - "**.import" # this means a png changed
+ - "**.tres" # godot resources
+ - "**.ttf" # fonts in godot3 dont have their own .import
+ - ".github/workflows/export.yml" # this workflow
+ - "export_presets.cfg" # the export template
+
+jobs: # the things to do
+ export: # a thing to do
+ uses: bend-n/godot-actions/.github/workflows/callable-export.yml@main
+ with: # variables
+ image: ghcr.io/bend-n/godot-2d:3.5 # the container to use
+ export-name: ${{ github.event.repository.name }} # the name of the exec. ($export-name.exe)
+ platforms: "windows linux web android mac" # space seperated list of platforms to build
+ project-root-path: "." # the directory that project.godot is in
+ github-pages: "true" # to deploy to github pages or not (anything besides 'true' == false)
+ itch-path: "${{ github.repository_owner }}/${{ github.event.repository.name }}" # required for itch.io deployment.
+ secrets: # secrets
+ butler-api-key: ${{ secrets.BUTLER_CREDENTIALS }} # required for itch.io deployment
+ android-keystore-base64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} # for signing the apk, not required
+ android-keystore-password: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} # ditto
+```
+
+</details>
+
+### Configuration
+
+> **Note** If script is not compiled, it must contain a [shebang](<https://en.wikipedia.org/wiki/Shebang_(Unix)>)
+
+Create a file `./.github/post_export` that will be run after installation. The executable will be run with a argument, containing the platform. (eg: `./.github/post_export linux`)
+
+Bash example:
+
+```bash
+#!/bin/bash
+[[ $1 == "web" ]] && wget -nv "example.org" -O build/web/example.html
+```
+
+A `pre_export` file is also supported.