ci/cd: fix zip command for windows #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Create zip file | |
run: zip ${{ env.PROJECT_NAME }}-Windows.zip ${{ env.PROJECT_NAME }}.exe ${{ env.PROJECT_NAME }}.console.exe ${{ env.PROJECT_NAME }}.pck | |
- name: Upload binaries to Github release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./${{ env.PROJECT_NAME }}-Windows.zip | |
asset_name: ${{ env.PROJECT_NAME }}-Windows.zip | |
tag: ${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }} | |
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 }}-Linux.x86_64 | |
asset_name: ${{ env.PROJECT_NAME }}-Linux.x86_64 | |
tag: ${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }} | |
overwrite: true | |
body: "FutsalManager - version: ${{ env.VERSION_NAME }} code: ${{ env.VERSION_CODE }}" |