Skip to content

Commit

Permalink
ci: fix export commands
Browse files Browse the repository at this point in the history
  • Loading branch information
florianvazelle committed Jan 1, 2024
1 parent 0598929 commit 578dd8e
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 13 deletions.
35 changes: 35 additions & 0 deletions .github/actions/setup-godot/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Setup Godot
description: Setup Godot dependencies.
runs:
using: "composite"
steps:

- name: Installing Linux dependencies
if: ${{ runner.os == 'Linux' }}
shell: bash
run: sudo apt-get install -y pulseaudio xvfb x11-xserver-utils mesa-vulkan-drivers

- name: Starting X11 server on :0
if: ${{ runner.os == 'Linux' }}
shell: bash
run: xset -q || /bin/bash -c "sudo Xvfb -ac :0 -screen 0 1920x1080x24 > /dev/null 2>&1 &"
env:
DISPLAY: ":0"

- name: Check that X11 server is running
if: ${{ runner.os == 'Linux' }}
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 5
command: /bin/bash -c "xset -q > /dev/null 2>&1"
env:
DISPLAY: ":0"

- name: Starting dummy sound device
if: ${{ runner.os == 'Linux' }}
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 3
command: pulseaudio --check || pulseaudio -D
6 changes: 6 additions & 0 deletions .github/workflows/release-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
- name: Load dotenv
run: just ci-load-dotenv

- name: Setup Godot dependencies
uses: ./.github/actions/setup-godot

- name: Export
run: just export

Expand All @@ -68,6 +71,9 @@ jobs:
- name: Load dotenv
run: just ci-load-dotenv

- name: Setup Godot dependencies
uses: ./.github/actions/setup-godot

- name: Export
run: just export-web

Expand Down
39 changes: 30 additions & 9 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,12 @@ install-templates:
# Download game plugins
install-addons:
[ -f plug.gd ] && just godot --headless --script plug.gd install || true
[ -f plug.gd ] && just godot --script plug.gd install || true

# Workaround from https://github.com/godotengine/godot/pull/68461
# Import game resources
import-resources:
just godot --headless --export-pack null /dev/null
# timeout 60 just godot --editor || true
# just godot --headless --quit --editor
timeout 60 just godot --export-pack null /dev/null || true

# Updates the game version for export
@bump-version:
Expand All @@ -131,7 +129,12 @@ import-resources:

# Godot binary wrapper
@godot *ARGS: makedirs install-godot install-templates
{{ godot_bin }} {{ ARGS }}
#!/usr/bin/env sh
if [ "{{ env("CI", "false") }}" = "true" ]; then
just ci-godot-x11 {{ ARGS }}
else
{{ godot_bin }} {{ ARGS }}
fi
# Open the Godot editor
editor:
Expand All @@ -145,27 +148,27 @@ fmt:
# Export game on Windows
export-windows: bump-version install-addons import-resources
mkdir -p {{ build_dir }}/windows
just godot --export-release '"Windows Desktop"' --headless {{ build_dir }}/windows/{{ game_name }}.exe
just godot --export-release '"Windows Desktop"' {{ build_dir }}/windows/{{ game_name }}.exe
(cd {{ build_dir }}/windows && zip {{ game_name }}-windows-v{{ game_version }}.zip -r .)
mv {{ build_dir }}/windows/{{ game_name }}-windows-v{{ game_version }}.zip {{ dist_dir }}/{{ game_name }}-windows-v{{ game_version }}.zip
rm -rf {{ build_dir }}/windows

# Export game on MacOS
export-mac: bump-version install-addons import-resources
just godot --export-release "macOS" --headless {{ dist_dir }}/{{ game_name }}-mac-v{{ game_version }}.zip
just godot --export-release "macOS" {{ dist_dir }}/{{ game_name }}-mac-v{{ game_version }}.zip

# Export game on Linux
export-linux: bump-version install-addons import-resources
mkdir -p {{ build_dir }}/linux
just godot --export-release "Linux/X11" --headless {{ build_dir }}/linux/{{ game_name }}.x86_64
just godot --export-release "Linux/X11" {{ build_dir }}/linux/{{ game_name }}.x86_64
(cd {{ build_dir }}/linux && zip {{ game_name }}-linux-v{{ game_version }}.zip -r .)
mv {{ build_dir }}/linux/{{ game_name }}-linux-v{{ game_version }}.zip {{ dist_dir }}/{{ game_name }}-linux-v{{ game_version }}.zip
rm -rf {{ build_dir }}/linux

# Export game for the web
export-web: bump-version install-addons import-resources
mkdir -p {{ build_dir }}/web
just godot --export-release "Web" --headless {{ build_dir }}/web/index.html
just godot --export-release "Web" {{ build_dir }}/web/index.html

# Export on all platform
export: export-windows export-mac export-linux
Expand Down Expand Up @@ -198,6 +201,24 @@ ci-load-dotenv:
echo "game_name={{ game_name }}" >> $GITHUB_ENV
echo "game_version={{ game_version }}" >> $GITHUB_ENV

# Starts godot using Xvfb and pulseaudio
ci-godot-x11 *ARGS:
#!/bin/bash
set -e
# Set locale to 'en' if locale is not already set.
# Godot will fallback to this locale anyway and it
# prevents an error message being printed to console.
[ "$LANG" == "C.UTF-8" ] && LANG=en || true

# Start dummy sound device.
pulseaudio --check || pulseaudio -D

# Running godot with X11 Display.
xvfb-run --auto-servernum {{ godot_bin }} {{ ARGS }}

# Cleanup (allowed to fail).
pulseaudio -k || true

# Download Butler
[private]
install-butler: makedirs
Expand Down
8 changes: 4 additions & 4 deletions export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ application/modify_resources=true
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version="1.4.4.20231203"
application/product_version="1.4.4.20231203"
application/file_version="1.0.0.20231231"
application/product_version="1.0.0.20231231"
application/company_name="Mechanical Flower"
application/product_name="Marble"
application/file_description=""
Expand Down Expand Up @@ -130,8 +130,8 @@ application/icon_interpolation=4
application/bundle_identifier="io.itch.MechanicalFlower"
application/signature=""
application/app_category="Games"
application/short_version="1.4"
application/version="1.4.4"
application/short_version="1.0"
application/version="1.0.0"
application/copyright="2023-present Mechanical Flower"
application/copyright_localized={}
application/min_macos_version="10.12"
Expand Down

0 comments on commit 578dd8e

Please sign in to comment.