Skip to content

Commit

Permalink
Upgrade project and add script to generate archive
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvaneenwyk committed May 25, 2024
1 parent 809528c commit 2255357
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 250 deletions.
27 changes: 10 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,22 @@ jobs:
submodule: recursive
fetch-depth: 0

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

- name: Restore NuGet packages
run: nuget restore UnityLauncherPro.sln
run: dotnet restore

- name: Build Binary
shell: cmd
run: call ./Build.cmd
run: dotnet build

- name: Build Artifact
shell: cmd
run: call ./ArtifactBuild.cmd
- name: Create Archive
shell: powershell
run: ./CreateArchive.ps1
env:
COMMIT_MESSAGE: "${{ github.event.commits[0].message }}"

- name: Get current date and time
id: datetime
Expand Down
33 changes: 33 additions & 0 deletions CreateArchive.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$ScriptPath = split-path -parent $MyInvocation.MyCommand.Definition
Write-Output "Path of the script : $ScriptPath"

# Convert commit message to a single line if multiline
$singleLineStrVal = "$Env:COMMIT_MESSAGE" -replace "`r`n", " " -replace "`n", " "
if($singleLineStrVal -match '#GITBUILD')
{
Write-Host 'Commit message matched with "#GITBUILD"'
}

try {
Import-Module 7Zip4PowerShell
} catch {
Write-Host 'Installing 7Zip PowerShell module'
Install-Module 7Zip4PowerShell -Force -Verbose -MinimumVersion "2.4"
}

try {
dotnet build --verbosity=detailed --self-contained --nologo --configuration=Release --arch=x64 "$ScriptPath/UnityLauncherPro/UnityLauncherPro.csproj"
Write-Host 'Finished building project.'

Write-Host 'Compressing executable into archive...'
$OutputFilename = "UnityLauncherPro.zip"
$OutputPath = "$ScriptPath/.build/$OutputFilename"
if (Test-Path "$OutputPath" -PathType Leaf) {
Remove-Item -Force -Path "$OutputPath"
}
Compress-7Zip -Path "$ScriptPath/UnityLauncherPro/bin/Release/net8.0-windows/win-x64" -ArchiveFilename "$OutputFilename" -OutputPath "$OutputPath"

Write-Host "Archive now available here: '$ScriptPath/UnityLauncherPro.zip'"
} catch {
Write-Error 'Failed to update archive.'
}
74 changes: 43 additions & 31 deletions UnityLauncherPro.sln
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.539
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityLauncherPro", "UnityLauncherPro\UnityLauncherPro.csproj", "{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD70E364-F81A-402C-A387-1BEB396796A2}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.34902.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityLauncherPro", "UnityLauncherPro\UnityLauncherPro.csproj", "{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|ARM64.ActiveCfg = Debug|ARM64
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|ARM64.Build.0 = Debug|ARM64
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|x64.ActiveCfg = Debug|x64
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Debug|x64.Build.0 = Debug|x64
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|ARM64.ActiveCfg = Release|ARM64
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|ARM64.Build.0 = Release|ARM64
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|x64.ActiveCfg = Release|x64
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD70E364-F81A-402C-A387-1BEB396796A2}
EndGlobalSection
EndGlobal
91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|x64.ActiveCfg = Release|x64
{EC78D91A-3E63-4CAA-8BC3-9673A30FDA45}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD70E364-F81A-402C-A387-1BEB396796A2}
EndGlobalSection
EndGlobal
Loading

0 comments on commit 2255357

Please sign in to comment.