tools for exporting godot projects via Github Actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
name: Setup
description: Setup godot and repo
runs:
using: "composite"
steps:
- name: Check if clean
id: clean
run: |
if [[ -z $(find . -mindepth 1 -maxdepth 1) ]]; then echo "clean=true" >> "$GITHUB_OUTPUT";
else echo "clean=false" >> "$GITHUB_OUTPUT"; fi
shell: bash
- name: Checkout
if: steps.clean.outputs.clean == 'true'
uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
submodules: recursive
- name: Setup python
if: steps.clean.outputs.clean == 'true'
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Setup godot
if: steps.clean.outputs.clean == '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
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="$(python pv.py "$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"
if [[ ${GODOT_VERSION:0:1} -gt 3 ]]; then
wget -q "https://github.com/bend-n/godot-builds/releases/download/3.5/godot-2d_v3.5_linux_headless.64" -O /usr/local/bin/godot3
chmod +x /usr/local/bin/godot3
else
ln -s /usr/local/bin/godot /usr/local/bin/godot3
fi
[[ ! -d addons ]] && mkdir addons
git clone -q --depth 1 https://github.com/you-win/godot-package-manager
mv godot-package-manager/addons/godot-package-manager addons/
godot3 -s addons/godot-package-manager/cli.gd update || true
rm -rf addons/godot-package-manager godot-package-manager
fi
echo "::endgroup::"
shell: bash
|