tools for exporting godot projects via Github Actions
check if clean
bendn 2022-07-25
parent e38fa60 · commit 01e37fd
-rw-r--r--.github/actions/export-web/action.yml6
-rw-r--r--.github/actions/setup-godot/action.yml13
2 files changed, 18 insertions, 1 deletions
diff --git a/.github/actions/export-web/action.yml b/.github/actions/export-web/action.yml
index ecf955c..6e68b00 100644
--- a/.github/actions/export-web/action.yml
+++ b/.github/actions/export-web/action.yml
@@ -31,7 +31,13 @@ runs:
name: web
path: build/web
+ - name: Test git repo
+ id: is-repo
+ run: "echo ::set-output name=is-repo::$(git rev-parse --is-inside-work-tree || echo false)"
+ shell: bash
+
- name: Deploy
+ if: steps.is-repo.outputs.is-repo == true
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages
diff --git a/.github/actions/setup-godot/action.yml b/.github/actions/setup-godot/action.yml
index 149ee51..5578d2d 100644
--- a/.github/actions/setup-godot/action.yml
+++ b/.github/actions/setup-godot/action.yml
@@ -4,7 +4,18 @@ 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 "::set-output name=clean::true" && echo "clean"
+ else
+ echo "::set-output name=clean::false" && echo "dirty"
+ fi
+ shell: bash
+
- name: Checkout
+ if: steps.clean.outputs.clean == 'true'
uses: actions/checkout@v3
with:
lfs: true
@@ -13,7 +24,7 @@ runs:
run: |
echo "::group::Setup godot"
git config --global --add safe.directory $(pwd)
- git rev-parse --short HEAD > version
+ git rev-parse --short HEAD > version || true
mkdir -v -p ~/.local/share/godot/templates
[[ -z $RELEASE ]] && RELEASE=stable
mv /root/.local/share/godot/templates/${GODOT_VERSION}.${RELEASE} ~/.local/share/godot/templates/${GODOT_VERSION}.${RELEASE}