Skip to content

Commit

Permalink
ci/cd: create linux and windows builds ci
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Jan 22, 2024
1 parent 2aef7f6 commit 898c036
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/upload-dekstop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# SPDX-FileCopyrightText: 2023 Simon Dalvai <[email protected]>

# SPDX-License-Identifier: CC0-1.0

name: CI/CD desktop

on:
push:
paths:
- "version"
- ".github/workflows/upload-dekstop.yml"
- "game/export_presets.desktop.example"

env:
GODOT_VERSION: 4.2.1
PROJECT_NAME: FutsalManager
WORKING_DIR: game

jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/prod'
steps:
- uses: actions/checkout@v2

- name: Cache Godot files
id: cache-godot
uses: actions/cache@v3
with:
path: |
~/.local/share/godot/**
/usr/local/bin/godot
~/.config/godot/**
key: ${{ runner.os }}-godot-${{ env.GODOT_VERSION }}

- name: Read version number and version code
run: |
echo "VERSION_NAME=$(cat version | cut -f1 -d-)" >> $GITHUB_ENV
echo "VERSION_CODE=$(cat version | cut -f2 -d-)" >> $GITHUB_ENV
- name: Download and config Godot Engine linux server and templates
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
wget -q https://downloads.tuxfamily.org/godotengine/${{ env.GODOT_VERSION }}/Godot_v${{ env.GODOT_VERSION }}-stable_linux.x86_64.zip
wget -q https://downloads.tuxfamily.org/godotengine/${{ env.GODOT_VERSION }}/Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz
mkdir ~/.cache
mkdir -p ~/.config/godot
mkdir -p ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable
unzip Godot_v${{ env.GODOT_VERSION }}-stable_linux.x86_64.zip
mv Godot_v${{ env.GODOT_VERSION }}-stable_linux.x86_64 /usr/local/bin/godot
unzip Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz
mv templates/* ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable
rm -f Godot_v${{ env.GODOT_VERSION }}-stable_linux.x86_64.zip Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz
godot --headless --editor --quit
####################
# WINDOWS
####################
# TODO install and configure rcedit tool https://github.com/electron/rcedit
# to create icon in Windows

- name: Prepare export_presets.cfg for Windows
run: cp ${{ env.WORKING_DIR }}/export_presets.windows.example ${{ env.WORKING_DIR }}/export_presets.cfg

- name: Export Godot 4
run: godot --headless --path ${{ env.WORKING_DIR }}/ --export-release 'Windows Desktop' ../${{ env.PROJECT_NAME }}.exe

- name: Upload binaries to Github release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ env.PROJECT_NAME }}.exe
asset_name: ${{ env.PROJECT_NAME }}.exe
tag: ${{ github.ref }}
overwrite: true
body: "FutsalManager - version: ${{ env.VERSION_NAME }} code: ${{ env.VERSION_CODE }}"

####################
# Linux
####################
- name: Prepare export_presets.cfg for Linux
run: cp ${{ env.WORKING_DIR }}/export_presets.linux.example ${{ env.WORKING_DIR }}/export_presets.cfg

- name: Export Godot 4
run: godot --headless --path ${{ env.WORKING_DIR }}/ --export-release 'Linux/X11' ../${{ env.PROJECT_NAME }}.x86_64

- name: Upload binaries to Github release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ env.PROJECT_NAME }}.x86_64
asset_name: ${{ env.PROJECT_NAME }}.x86_64
tag: ${{ github.ref }}
overwrite: true
body: "FutsalManager - version: ${{ env.VERSION_NAME }} code: ${{ env.VERSION_CODE }}"
39 changes: 39 additions & 0 deletions game/export_presets.linux.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[preset.0]

name="Linux/X11"
platform="Linux/X11"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="./FutsalManager.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false

[preset.0.options]

custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=true
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
62 changes: 62 additions & 0 deletions game/export_presets.windows.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[preset.0]

name="Windows Desktop"
platform="Windows Desktop"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false

[preset.0.options]

custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=true
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name="Simon Dalvai"
application/product_name="Futsal Manager"
application/file_description=""
application/copyright="2024 Simon Dalvai"
application/trademarks=""
application/export_angle=0
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"

0 comments on commit 898c036

Please sign in to comment.