- 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.
168 lines
4.8 KiB
YAML
168 lines
4.8 KiB
YAML
image: barichello/godot-ci:4.3
|
|
|
|
# NOTE: If your `project.godot` is at the repository root, set `PROJECT_PATH` below to ".".
|
|
|
|
# Cache imported assets between runs
|
|
cache:
|
|
key: import-assets
|
|
paths:
|
|
- .godot/imported/
|
|
|
|
stages:
|
|
- import-assets
|
|
- export
|
|
- deploy
|
|
|
|
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:
|
|
stage: import-assets
|
|
script:
|
|
- godot --headless --verbose --editor --quit
|
|
|
|
linux:
|
|
stage: export
|
|
script:
|
|
- mkdir -v -p build/linux
|
|
- 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:
|
|
- build/linux
|
|
|
|
windows:
|
|
stage: export
|
|
script:
|
|
- mkdir -v -p build/windows
|
|
- 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:
|
|
- build/windows
|
|
|
|
mac:
|
|
stage: export
|
|
script:
|
|
- mkdir -v -p build/mac
|
|
- 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:
|
|
- build/mac
|
|
|
|
web:
|
|
stage: export
|
|
script:
|
|
- mkdir -v -p build/web
|
|
- 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:
|
|
- build/web
|
|
|
|
# Android Debug Job. It will use the generated debug.keystore.
|
|
android_debug:
|
|
stage: export
|
|
script:
|
|
- mkdir -v -p build/android
|
|
- 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:
|
|
- build/android
|
|
|
|
# Android Release Job. You will need to include keystore and password in the GitLab variable settings:
|
|
# 1. Take your generated keystore and convert it to Base64:
|
|
# Linux & macOS: `base64 release.keystore -w 0`
|
|
# Windows: `certutil -encodehex -f release.keystore encoded.txt 0x40000001`
|
|
# 2. Go to GitLab Project > Settings > CI/CD > Variables and copy the Base64-encoded keystore value in a new variable `SECRET_RELEASE_KEYSTORE_BASE64` as type variable.
|
|
# 3. Create a second variable SECRET_RELEASE_KEYSTORE_USER as type variable with the alias of your keystore as value.
|
|
# 4. Create a third variable SECRET_RELEASE_KEYSTORE_PASSWORD as type variable with the password of your keystore as value.
|
|
android:
|
|
stage: export
|
|
rules:
|
|
- if: $SECRET_RELEASE_KEYSTORE_BASE64
|
|
- if: $SECRET_RELEASE_KEYSTORE_USER
|
|
- if: $SECRET_RELEASE_KEYSTORE_PASSWORD
|
|
script:
|
|
- echo $SECRET_RELEASE_KEYSTORE_BASE64 | base64 --decode > /root/release.keystore
|
|
- mkdir -v -p build/android
|
|
- 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" $EXPORT_DIR/android/$EXPORT_NAME.apk
|
|
artifacts:
|
|
name: $EXPORT_NAME-$CI_JOB_NAME
|
|
paths:
|
|
- build/android
|
|
|
|
# GitHub Pages Deploy
|
|
deploy-github-pages:
|
|
stage: deploy
|
|
dependencies:
|
|
- web
|
|
script:
|
|
# This ensures the `gh-pages` branch is available.
|
|
- git fetch
|
|
- git checkout gh-pages
|
|
- rm -f *.md
|
|
- mv build/web/** .
|
|
- git config user.email $GIT_EMAIL
|
|
- git config user.name $GIT_USERNAME
|
|
- git remote add github $REMOTE_URL
|
|
- git add -A
|
|
- 'git commit -m "ci: Deploy GitHub Page | $EXPORT_NAME:$CI_JOB_NAME" -m "Deploy from GitLab pipeline #$CI_PIPELINE_ID" || true'
|
|
- git push github gh-pages -f
|
|
|
|
# GitLab Pages Deploy
|
|
pages:
|
|
stage: deploy
|
|
dependencies:
|
|
- web
|
|
script:
|
|
# This ensures the `pages` branch is available.
|
|
- git fetch
|
|
- git checkout pages
|
|
- rm -f *.md
|
|
- mv build/web/** ./public
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
|
|
# Itch.io Deploy
|
|
itchio:linux:
|
|
stage: deploy
|
|
script:
|
|
- butler push ./build/linux $ITCHIO_USERNAME/$ITCHIO_GAME:linux
|
|
dependencies:
|
|
- linux
|
|
|
|
itchio:windows:
|
|
stage: deploy
|
|
script:
|
|
- butler push ./build/windows $ITCHIO_USERNAME/$ITCHIO_GAME:windows
|
|
dependencies:
|
|
- windows
|
|
|
|
itchio:macosx:
|
|
stage: deploy
|
|
script:
|
|
- butler push ./build/mac $ITCHIO_USERNAME/$ITCHIO_GAME:mac
|
|
dependencies:
|
|
- mac
|