name: Setup 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 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.setup.outputs.needed == 'true' uses: actions/setup-python@v4 with: python-version: "3.9" - name: Setup godot if: steps.setup.outputs.needed == 'true' run: | 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