Skip to content

Commit a31657d

Browse files
committedFeb 25, 2024
Merge branch 'dev'
* dev: fix double backslash on download and install path apply StreamerMode at start fix init script Fetch (if didnt have scripts/ folder) Update main.yml Update main.yml #GITBUILD Update main.yml #GITBUILD Update main.yml add timestamp #GITBUILD Update main.yml for #GITBUILD Update ArtifactBuild.cmd #TEST Update main.yml #TEST Update main.yml #TEST Create ArtifactBuild.cmd Create Build.cmd Create main.yml #TEST
2 parents ee58811 + d2226d7 commit a31657d

File tree

5 files changed

+103
-4
lines changed

5 files changed

+103
-4
lines changed
 

Diff for: ‎.github/workflows/main.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This is a basic workflow to help you get started with Actions
2+
name: CI
3+
4+
# Controls when the workflow will run
5+
on:
6+
# Triggers the workflow on push or pull request events but only for the master branch
7+
push:
8+
branches: [ master ]
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
15+
# This workflow contains a single job called "build"
16+
build:
17+
# The type of runner that the job will run on
18+
runs-on: windows-2019
19+
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
- name: Check Commit and Install 7Zip PowerShell Module
23+
shell: powershell
24+
25+
run: |
26+
# cancel early, if not build commit
27+
$strVal ='${{ github.event.commits[0].message }}'
28+
if($strVal -clike '*#GITBUILD*')
29+
{
30+
Write-Host 'True'
31+
} else {
32+
Write-Host 'False'
33+
exit(1)
34+
}
35+
Install-Module 7Zip4PowerShell -Force -Verbose
36+
- uses: actions/checkout@v2
37+
38+
- name: Restore NuGet packages
39+
run: nuget restore UnityLauncherPro.sln
40+
41+
- name: Build Binary
42+
shell: cmd
43+
run: call .\Build.cmd
44+
45+
- name: Build Artifact
46+
shell: cmd
47+
run: call .\ArtifactBuild.cmd
48+
49+
- name: Get current date and time
50+
id: datetime
51+
run: echo "::set-output name=current_datetime::$(date +'%d/%m/%Y %H:%M')"
52+
53+
- name: Create Release
54+
id: create_release
55+
uses: actions/create-release@latest
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
tag_name: ${{github.run_number}}
60+
release_name: ${{ steps.datetime.outputs.current_datetime }} (${{ github.run_number }})
61+
body: |
62+
Automated Release by GitHub Action CI
63+
draft: false
64+
prerelease: false
65+
66+
- name: Upload Release Asset
67+
id: upload-release-asset
68+
uses: actions/upload-release-asset@v1
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
with:
72+
upload_url: ${{ steps.create_release.outputs.upload_url }}
73+
asset_path: ./UnityLauncherPro.zip
74+
asset_name: UnityLauncherPro.zip
75+
asset_content_type: application/zip
76+

Diff for: ‎ArtifactBuild.cmd

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
pushd "%~dp0"
3+
powershell Compress-7Zip "UnityLauncherPro\bin\Release\UnityLauncherPro.exe" -ArchiveFileName "UnityLauncherPro.zip" -Format Zip
4+
:exit
5+
popd
6+
@echo on

Diff for: ‎Build.cmd

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@echo off
2+
pushd "%~dp0"
3+
if exist Debug rd /s /q Debug
4+
if exist Release rd /s /q Release
5+
if exist x64 rd /s /q x64
6+
7+
"%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" /p:Configuration=Release
8+
9+
:exit
10+
popd
11+
@echo on

Diff for: ‎UnityLauncherPro/MainWindow.xaml.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1990,8 +1990,6 @@ private void ChkAskNameForQuickProject_Checked(object sender, RoutedEventArgs e)
19901990
bool isInitializing = true; // used to avoid doing things while still starting up
19911991
private void ChkStreamerMode_Checked(object sender, RoutedEventArgs e)
19921992
{
1993-
if (this.IsActive == false) return; // dont run code on window init
1994-
19951993
var isChecked = (bool)((CheckBox)sender).IsChecked;
19961994

19971995
Settings.Default.streamerMode = isChecked;

Diff for: ‎UnityLauncherPro/Tools.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,12 @@ public static void DownloadAndInstall(string url, string version)
641641
if (DownloadFile(exeURL, tempFile) == true)
642642
{
643643
// get base version, to use for install path
644-
string outputVersionFolder = "\\" + version.Split('.')[0] + "_" + version.Split('.')[1];
645-
string targetPathArgs = " /D=" + Properties.Settings.Default.rootFolders[Properties.Settings.Default.rootFolders.Count - 1] + outputVersionFolder; ;
644+
// FIXME check if have any paths?
645+
string lastRootFolder = Properties.Settings.Default.rootFolders[Properties.Settings.Default.rootFolders.Count - 1];
646+
// check if ends with / or \
647+
if (lastRootFolder.EndsWith("/") == false && lastRootFolder.EndsWith("\\") == false) lastRootFolder += "/";
648+
string outputVersionFolder = version.Split('.')[0] + "_" + version.Split('.')[1];
649+
string targetPathArgs = " /D=" + lastRootFolder + outputVersionFolder; ;
646650

647651
// if user clicks NO to UAC, this fails (so added try-catch)
648652
try
@@ -691,6 +695,7 @@ public static void DownloadInitScript(string currentInitScriptFullPath, string c
691695
{
692696
// check if file exists
693697
if (File.Exists(currentInitScriptLocationOrURL) == false) return;
698+
694699
tempFile = currentInitScriptLocationOrURL;
695700
isLocalFile = true;
696701
}
@@ -705,6 +710,9 @@ public static void DownloadInitScript(string currentInitScriptFullPath, string c
705710
var tempContent = File.ReadAllText(tempFile);
706711
if (tempContent.IndexOf("public class InitializeProject") > 0 && tempContent.IndexOf("namespace UnityLauncherProTools") > 0 && tempContent.IndexOf("public static void Init()") > 0)
707712
{
713+
// create scripts folder if missing
714+
if (Directory.Exists(currentInitScriptFolder) == false) Directory.CreateDirectory(currentInitScriptFolder);
715+
708716
// move old file as backup
709717
if (File.Exists(currentInitScriptFullPath))
710718
{

0 commit comments

Comments
 (0)