Skip to content

Commit

Permalink
Fix invalid paths in GitHub Actions and GitLab CI workflow files (#157)
Browse files Browse the repository at this point in the history
- Automatically adapt the export folder based on project folder
  location relative to the repository root.
- Update workflow files to use Godot 4.3.
- Update default export prest names to match Godot 4.0 onwards.
  • Loading branch information
Calinou authored Oct 18, 2024
1 parent b87499e commit 4d5edd8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/godot-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: "godot-ci export"
on: push

# NOTE: If your `project.godot` is at the repository root, set `PROJECT_PATH` below to ".".

env:
GODOT_VERSION: 4.2.1
GODOT_VERSION: 4.3
EXPORT_NAME: test-project
PROJECT_PATH: test-project

Expand All @@ -11,7 +13,7 @@ jobs:
name: Windows Export
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.2.1
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -26,8 +28,9 @@ jobs:
- name: Windows Build
run: |
mkdir -v -p build/windows
EXPORT_DIR="$(readlink -f build)"
cd $PROJECT_PATH
godot --headless --verbose --export-release "Windows Desktop" ../build/windows/$EXPORT_NAME.exe
godot --headless --verbose --export-release "Windows Desktop" "$EXPORT_DIR/windows/$EXPORT_NAME.exe"
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
Expand All @@ -38,7 +41,7 @@ jobs:
name: Linux Export
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.2.1
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -51,8 +54,9 @@ jobs:
- name: Linux Build
run: |
mkdir -v -p build/linux
EXPORT_DIR="$(readlink -f build)"
cd $PROJECT_PATH
godot --headless --verbose --export-release "Linux/X11" ../build/linux/$EXPORT_NAME.x86_64
godot --headless --verbose --export-release "Linux" "$EXPORT_DIR/linux/$EXPORT_NAME.x86_64"
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
Expand All @@ -63,7 +67,7 @@ jobs:
name: Web Export
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.2.1
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -76,8 +80,9 @@ jobs:
- name: Web Build
run: |
mkdir -v -p build/web
EXPORT_DIR="$(readlink -f build)"
cd $PROJECT_PATH
godot --headless --verbose --export-release "HTML5" ../build/web/index.html
godot --headless --verbose --export-release "Web" "$EXPORT_DIR/web/index.html"
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
Expand All @@ -96,7 +101,7 @@ jobs:
name: Mac Export
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.2.1
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -109,8 +114,9 @@ jobs:
- name: Mac Build
run: |
mkdir -v -p build/mac
EXPORT_DIR="$(readlink -f build)"
cd $PROJECT_PATH
godot --headless --verbose --export-release "Mac OSX" ../build/mac/$EXPORT_NAME.zip
godot --headless --verbose --export-release "macOS" "$EXPORT_DIR/mac/$EXPORT_NAME.zip"
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
Expand Down
36 changes: 21 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
image: barichello/godot-ci:4.0.2
image: barichello/godot-ci:4.3

# NOTE: the `cd` command in each build stage is not necessary if your
# project.godot is at the repo root
# NOTE: If your `project.godot` is at the repository root, set `PROJECT_PATH` below to ".".

# Cache imported assets between runs
cache:
Expand All @@ -16,6 +15,7 @@ stages:

variables:
EXPORT_NAME: test-project
PROJECT_PATH: test-project

# Open the editor to import assets in case the cache was empty or outdated
import-assets:
Expand All @@ -27,8 +27,9 @@ linux:
stage: export
script:
- mkdir -v -p build/linux
- cd $EXPORT_NAME
- godot --headless --verbose --export-release "Linux/X11" ../build/linux/$EXPORT_NAME.x86_64
- EXPORT_DIR="$(readlink -f build)"
- cd $PROJECT_PATH
- godot --headless --verbose --export-release "Linux" "$EXPORT_DIR/linux/$EXPORT_NAME.x86_64"
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
Expand All @@ -38,8 +39,9 @@ windows:
stage: export
script:
- mkdir -v -p build/windows
- cd $EXPORT_NAME
- godot --headless --verbose --export-release "Windows Desktop" ../build/windows/$EXPORT_NAME.exe
- EXPORT_DIR="$(readlink -f build)"
- cd $PROJECT_PATH
- godot --headless --verbose --export-release "Windows Desktop" "$EXPORT_DIR/windows/$EXPORT_NAME.exe"
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
Expand All @@ -49,8 +51,9 @@ mac:
stage: export
script:
- mkdir -v -p build/mac
- cd $EXPORT_NAME
- godot --headless --verbose --export-release "Mac OSX" ../build/mac/$EXPORT_NAME.zip
- EXPORT_DIR="$(readlink -f build)"
- cd $PROJECT_PATH
- godot --headless --verbose --export-release "macOS" "$EXPORT_DIR/mac/$EXPORT_NAME.zip"
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
Expand All @@ -60,8 +63,9 @@ web:
stage: export
script:
- mkdir -v -p build/web
- cd $EXPORT_NAME
- godot --headless --verbose --export-release "HTML5" ../build/web/index.html
- EXPORT_DIR="$(readlink -f build)"
- cd $PROJECT_PATH
- godot --headless --verbose --export-release "Web" "$EXPORT_DIR/web/index.html"
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
Expand All @@ -72,8 +76,9 @@ android_debug:
stage: export
script:
- mkdir -v -p build/android
- cd $EXPORT_NAME
- godot --headless --verbose --export-debug "Android Debug" ../build/android/$EXPORT_NAME-debug.apk
- EXPORT_DIR="$(readlink -f build)"
- cd $PROJECT_PATH
- godot --headless --verbose --export-debug "Android Debug" "$EXPORT_DIR/android/$EXPORT_NAME-debug.apk"
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
Expand All @@ -95,11 +100,12 @@ android:
script:
- echo $SECRET_RELEASE_KEYSTORE_BASE64 | base64 --decode > /root/release.keystore
- mkdir -v -p build/android
- cd $EXPORT_NAME
- EXPORT_DIR="$(readlink -f build)"
- cd $PROJECT_PATH
- sed 's@keystore/release=".*"@keystore/release="'/root/release.keystore'"@g' -i export_presets.cfg
- sed 's@keystore/release_user=".*"@keystore/release_user="'$SECRET_RELEASE_KEYSTORE_USER'"@g' -i export_presets.cfg
- sed 's@keystore/release_password=".*"@keystore/release_password="'$SECRET_RELEASE_KEYSTORE_PASSWORD'"@g' -i export_presets.cfg
- godot --headless --verbose --export-release "Android" ../build/android/$EXPORT_NAME.apk
- godot --headless --verbose --export-release "Android" $EXPORT_DIR/android/$EXPORT_NAME.apk
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
Expand Down

1 comment on commit 4d5edd8

@gomes042
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR: #160


Image

Please sign in to comment.