-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (94 loc) · 3.74 KB
/
Build_Exe.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: 🖥️ Build Windows EXE
on:
workflow_dispatch:
push:
branches:
- main
paths:
- '**/GodotFolderTest2.csproj'
jobs:
build_windows_exe:
name: Build Windows EXE
runs-on: windows-latest
steps:
- name: 🧾 Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: 'recursive'
- name: Read Godot version from global.json
id: godot_version
run: |
$godotVersion = Get-Content -Raw -Path 'global.json' | ConvertFrom-Json | Select-Object -ExpandProperty 'msbuild-sdks' | Select-Object -ExpandProperty 'Godot.NET.Sdk'
echo "Godot version: $godotVersion"
echo "::set-output name=VERSION::$godotVersion"
- name: Print extracted version
run: echo "The extracted Godot version is $env:VERSION"
- name: Extract Version from Project File
id: project_version
run: |
[xml]$csprojContent = Get-Content -Path "GodotFolderTest2.csproj"
$version = $csprojContent.Project.PropertyGroup.Version
echo "PROJECTVERSION=$version" | Out-File -Append -FilePath $Env:GITHUB_ENV
- name: Print extracted PROJECTversion
run: echo "The extracted Project version is $env:PROJECTVERSION"
- name: 💽 Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
# Use the .NET SDK from global.json in the root of the repository.
global-json-file: global.json
- name: 📦 Restore Dependencies
run: dotnet restore
- name: 🤖 Setup Godot
uses: chickensoft-games/setup-godot@v1
with:
version: global.json
- name: Create Build Directory
run: mkdir -p ${{ github.workspace }}\\Release
- name: 🧑🔬 Generate .NET Bindings and .godot folder
run: godot --headless --build-solutions --quit || exit 0
- name: Build Windows EXE
run: |
godot --headless --export-release "Windows Desktop"
- name: Zip Release Build
run: |
cd ${{ github.workspace }}\Release
Compress-Archive -Path .\* -DestinationPath ${{ github.workspace }}\ConnectAPIC.zip
echo "zip_path=${{ github.workspace }}\ConnectAPIC.zip" >> $GITHUB_ENV
shell: powershell
- name: List files in Release Directory
run: |
$releaseDir = "${{ github.workspace }}\Release"
Write-Host "Checking files in folder $releaseDir"
if (-Not (Test-Path -Path $releaseDir -PathType Container)) {
Write-Host "Error: Release directory does not exist."
exit 1
}
$items = Get-ChildItem -Path $releaseDir
if ($items.Count -eq 0) {
Write-Host "Error: No files found in the Release directory."
exit 1
}
Write-Host "Files in Release Directory:"
$items | Format-Table -AutoSize
shell: powershell
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.project_version.outputs.VERSION }}-${{ github.run_number }}
release_name: Release v${{ steps.project_version.outputs.VERSION }}
draft: false
prerelease: false
body: "automatically generated release"
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.zip_path }}
asset_name: GodotFolderTest2.zip
asset_content_type: application/zip