Skip to content

Commit

Permalink
ci: use macos runner
Browse files Browse the repository at this point in the history
  • Loading branch information
florianvazelle committed Jan 13, 2024
1 parent c85610c commit 6f44f45
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 35 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/release-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
[ "${{ env.game_version }}" == "${{ env.BRANCH_NAME }}" ] || exit 2
build:
runs-on: ubuntu-22.04
timeout-minutes: 30
runs-on: macos-12
timeout-minutes: 10
needs: [check]

steps:
Expand All @@ -54,8 +54,8 @@ jobs:
uses: actions/cache@v3
with:
path: |
~/.mkflower/bin
~/.local/share/godot/export_templates/${{ env.godot_version }}.stable
/Applications/Godot.app
"~/Library/Application Support/Godot/export_templates"
key: ${{ env.godot_version }}

- name: Export
Expand All @@ -69,8 +69,8 @@ jobs:
retention-days: 1

deploy:
runs-on: ubuntu-22.04
timeout-minutes: 30
runs-on: macos-12
timeout-minutes: 3
needs: [check]

if: github.ref == 'refs/heads/main'
Expand All @@ -86,8 +86,8 @@ jobs:
uses: actions/cache@v3
with:
path: |
~/.mkflower/bin
~/.local/share/godot/export_templates/${{ env.godot_version }}.stable
/Applications/Godot.app
"~/Library/Application Support/Godot/export_templates"
key: ${{ env.godot_version }}

- name: Load dotenv
Expand Down
69 changes: 42 additions & 27 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,31 @@ dist_dir := justfile_directory() / "dist"

# Godot variables
godot_version := env_var('GODOT_VERSION')
godot_platform := if arch() == "x86" {
"linux.x86_32"
godot_platform := if os() == "windows" {
if arch() == "x86" { "win32.exe" }
else if arch() == "x86_64" { "win64.exe" }
else { "" }
} else if os() == "macos" {
"macos.universal"
} else {
if arch() == "x86_64" {
"linux.x86_64"
} else {
if arch() == "arm" {
"linux.arm32"
} else {
if arch() == "aarch64" {
"linux.arm64"
} else { "" }
}
}
if arch() == "x86" { "linux.x86_32" }
else if arch() == "x86_64" { "linux.x86_64" }
else if arch() == "arm" { "linux.arm32" }
else if arch() == "aarch64" { "linux.arm64" }
else { "" }
}
godot_filename := "Godot_v" + godot_version + "-stable_" + godot_platform
godot_template := "Godot_v" + godot_version + "-stable_export_templates.tpz"
godot_bin := bin_dir / godot_filename
godot_editor_data_dir := "~/.local/share/godot/"
use_x11_wrapper := if godot_platform =~ "x11*" { env("CI", "false") } else { "false" }
godot_bin := if os() == "macos" {
"/Applications/Godot.app/Contents/MacOS/Godot"
} else {
bin_dir / godot_filename
}
godot_editor_data_dir := if os() == "macos" {
"~/Library/Application Support/Godot/export_templates"
} else {
"~/.local/share/godot/"
}

# Game variables
game_name := env_var('GAME_NAME')
Expand Down Expand Up @@ -86,27 +91,37 @@ butler_platform := if arch() == "x86" { "linux-386" } else { if arch() == "x86_6
[ ! -d {{ venv_dir }} ] && python3 -m venv {{ venv_dir }} || true
. {{ venv_dir }}/bin/activate && {{ ARGS }}

# sed command that works on Linux and MacOs
[private]
@sed script file:
sed -i.bak -e {{ script }} -- "{{ file }}" && rm -- "{{ file }}.bak"

# Download Godot
[private]
install-godot:
#!/usr/bin/env sh
if [ ! -e {{ godot_bin }} ]
then
curl -X GET "https://downloads.tuxfamily.org/godotengine/{{ godot_version }}/{{ godot_filename }}.zip" --output {{ cache_dir }}/{{ godot_filename }}.zip
unzip {{ cache_dir }}/{{ godot_filename }}.zip -d {{ cache_dir }}
cp {{ cache_dir }}/{{ godot_filename }} {{ godot_bin }}
unzip -o {{ cache_dir }}/{{ godot_filename }}.zip -d {{ cache_dir }}
if [ "{{ os() }}" = "macos" ]; then
cp -r {{ cache_dir }}/Godot.app /Applications/Godot.app
else
cp {{ cache_dir }}/{{ godot_filename }} {{ godot_bin }}
fi
fi
# Download Godot export templates
[private]
install-templates:
#!/usr/bin/env sh
if [ ! -d {{ godot_editor_data_dir }}/export_templates/{{ godot_version }}.stable ]
if [ ! -d "{{ godot_editor_data_dir }}/export_templates/{{ godot_version }}.stable" ]
then
curl -X GET "https://downloads.tuxfamily.org/godotengine/{{ godot_version }}/{{ godot_template }}" --output {{ cache_dir }}/{{ godot_template }}
unzip {{ cache_dir }}/{{ godot_template }} -d {{ cache_dir }}
mkdir -p {{ godot_editor_data_dir }}/export_templates/{{ godot_version }}.stable
cp {{ cache_dir }}/templates/* {{ godot_editor_data_dir }}/export_templates/{{ godot_version }}.stable
unzip -o {{ cache_dir }}/{{ godot_template }} -d {{ cache_dir }}
mkdir -p "{{ godot_editor_data_dir }}/export_templates/{{ godot_version }}.stable"
cp {{ cache_dir }}/templates/* "{{ godot_editor_data_dir }}/export_templates/{{ godot_version }}.stable"
fi
# Download game plugins
Expand All @@ -120,10 +135,10 @@ import-resources:
# Updates the game version for export
@bump-version:
echo "Update version in the presets.cfg"
sed -i "s,application/file_version=.*$,application/file_version=\"{{ game_version }}.{{ datetime }}\",g" ./export_presets.cfg
sed -i "s,application/product_version=.*$,application/product_version=\"{{ game_version }}.{{ datetime }}\",g" ./export_presets.cfg
sed -i "s,application/version=.*$,application/version=\"{{ game_version }}\",g" ./export_presets.cfg
sed -i "s,application/short_version=.*$,application/short_version=\"{{ short_version }}\",g" ./export_presets.cfg
just sed "s,application/file_version=.*$,application/file_version=\"{{ game_version }}.{{ datetime }}\",g" export_presets.cfg
just sed "s,application/product_version=.*$,application/product_version=\"{{ game_version }}.{{ datetime }}\",g" export_presets.cfg
just sed "s,application/version=.*$,application/version=\"{{ game_version }}\",g" export_presets.cfg
just sed "s,application/short_version=.*$,application/short_version=\"{{ short_version }}\",g" export_presets.cfg

echo "Create the override.cfg"
touch override.cfg
Expand Down Expand Up @@ -205,7 +220,7 @@ install-butler: makedirs
if [ ! -e {{ butler_bin }} ]
then
curl -L -X GET "https://broth.itch.ovh/butler/{{ butler_platform }}/LATEST/archive/default" --output {{ cache_dir }}/butler.zip
unzip {{ cache_dir }}/butler.zip -d {{ cache_dir }}
unzip -o {{ cache_dir }}/butler.zip -d {{ cache_dir }}
mv {{ cache_dir }}/butler {{ butler_bin }}
chmod +x {{ butler_bin }}
fi
Expand Down

0 comments on commit 6f44f45

Please sign in to comment.