Skip to content

Commit 2255357

Browse files
committed
Upgrade project and add script to generate archive
1 parent 809528c commit 2255357

File tree

4 files changed

+150
-250
lines changed

4 files changed

+150
-250
lines changed

Diff for: .github/workflows/main.yml

+10-17
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,22 @@ jobs:
2626
submodule: recursive
2727
fetch-depth: 0
2828

29-
- name: Check Commit and Install 7Zip PowerShell Module
30-
shell: powershell
31-
run: |
32-
# Convert commit message to a single line if multiline
33-
$singleLineStrVal = "$Env:COMMIT_MESSAGE" -replace "`r`n", " " -replace "`n", " "
34-
if($singleLineStrVal -match '#GITBUILD')
35-
{
36-
Write-Host 'Commit message matched with "#GITBUILD"'
37-
}
38-
Write-Host 'Installing 7Zip PowerShell module'
39-
env:
40-
COMMIT_MESSAGE: "${{ github.event.commits[0].message }}"
29+
- uses: actions/setup-dotnet@v4
30+
with:
31+
dotnet-version: "8.x"
4132

4233
- name: Restore NuGet packages
43-
run: nuget restore UnityLauncherPro.sln
34+
run: dotnet restore
4435

4536
- name: Build Binary
4637
shell: cmd
47-
run: call ./Build.cmd
38+
run: dotnet build
4839

49-
- name: Build Artifact
50-
shell: cmd
51-
run: call ./ArtifactBuild.cmd
40+
- name: Create Archive
41+
shell: powershell
42+
run: ./CreateArchive.ps1
43+
env:
44+
COMMIT_MESSAGE: "${{ github.event.commits[0].message }}"
5245

5346
- name: Get current date and time
5447
id: datetime

Diff for: CreateArchive.ps1

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
$ScriptPath = split-path -parent $MyInvocation.MyCommand.Definition
2+
Write-Output "Path of the script : $ScriptPath"
3+
4+
# Convert commit message to a single line if multiline
5+
$singleLineStrVal = "$Env:COMMIT_MESSAGE" -replace "`r`n", " " -replace "`n", " "
6+
if($singleLineStrVal -match '#GITBUILD')
7+
{
8+
Write-Host 'Commit message matched with "#GITBUILD"'
9+
}
10+
11+
try {
12+
Import-Module 7Zip4PowerShell
13+
} catch {
14+
Write-Host 'Installing 7Zip PowerShell module'
15+
Install-Module 7Zip4PowerShell -Force -Verbose -MinimumVersion "2.4"
16+
}
17+
18+
try {
19+
dotnet build --verbosity=detailed --self-contained --nologo --configuration=Release --arch=x64 "$ScriptPath/UnityLauncherPro/UnityLauncherPro.csproj"
20+
Write-Host 'Finished building project.'
21+
22+
Write-Host 'Compressing executable into archive...'
23+
$OutputFilename = "UnityLauncherPro.zip"
24+
$OutputPath = "$ScriptPath/.build/$OutputFilename"
25+
if (Test-Path "$OutputPath" -PathType Leaf) {
26+
Remove-Item -Force -Path "$OutputPath"
27+
}
28+
Compress-7Zip -Path "$ScriptPath/UnityLauncherPro/bin/Release/net8.0-windows/win-x64" -ArchiveFilename "$OutputFilename" -OutputPath "$OutputPath"
29+
30+
Write-Host "Archive now available here: '$ScriptPath/UnityLauncherPro.zip'"
31+
} catch {
32+
Write-Error 'Failed to update archive.'
33+
}

Diff for: UnityLauncherPro.sln

+43-31
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.28307.539
5-
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityLauncherPro", "UnityLauncherPro\UnityLauncherPro.csproj", "{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}"
7-
EndProject
8-
Global
9-
GlobalSection(Performance) = preSolution
10-
HasPerformanceSessions = true
11-
EndGlobalSection
12-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
13-
Debug|Any CPU = Debug|Any CPU
14-
Release|Any CPU = Release|Any CPU
15-
EndGlobalSection
16-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
17-
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18-
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|Any CPU.Build.0 = Debug|Any CPU
19-
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|Any CPU.ActiveCfg = Release|Any CPU
20-
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|Any CPU.Build.0 = Release|Any CPU
21-
EndGlobalSection
22-
GlobalSection(SolutionProperties) = preSolution
23-
HideSolutionNode = FALSE
24-
EndGlobalSection
25-
GlobalSection(ExtensibilityGlobals) = postSolution
26-
SolutionGuid = {CD70E364-F81A-402C-A387-1BEB396796A2}
27-
EndGlobalSection
28-
GlobalSection(Performance) = preSolution
29-
HasPerformanceSessions = true
30-
EndGlobalSection
31-
EndGlobal
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.10.34902.84
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityLauncherPro", "UnityLauncherPro\UnityLauncherPro.csproj", "{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}"
6+
EndProject
7+
Global
8+
GlobalSection(Performance) = preSolution
9+
HasPerformanceSessions = true
10+
EndGlobalSection
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|ARM64 = Debug|ARM64
13+
Debug|x64 = Debug|x64
14+
Release|ARM64 = Release|ARM64
15+
Release|x64 = Release|x64
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|ARM64.ActiveCfg = Debug|ARM64
19+
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|ARM64.Build.0 = Debug|ARM64
20+
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|x64.ActiveCfg = Debug|x64
21+
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|x64.Build.0 = Debug|x64
22+
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|ARM64.ActiveCfg = Release|ARM64
23+
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|ARM64.Build.0 = Release|ARM64
24+
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|x64.ActiveCfg = Release|x64
25+
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|x64.Build.0 = Release|x64
26+
EndGlobalSection
27+
GlobalSection(SolutionProperties) = preSolution
28+
HideSolutionNode = FALSE
29+
EndGlobalSection
30+
GlobalSection(ExtensibilityGlobals) = postSolution
31+
SolutionGuid = {CD70E364-F81A-402C-A387-1BEB396796A2}
32+
EndGlobalSection
33+
EndGlobal
34+
91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|x64.ActiveCfg = Release|x64
35+
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|x64.Build.0 = Release|x64
36+
EndGlobalSection
37+
GlobalSection(SolutionProperties) = preSolution
38+
HideSolutionNode = FALSE
39+
EndGlobalSection
40+
GlobalSection(ExtensibilityGlobals) = postSolution
41+
SolutionGuid = {CD70E364-F81A-402C-A387-1BEB396796A2}
42+
EndGlobalSection
43+
EndGlobal

0 commit comments

Comments
 (0)