Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
unitycoder committed Feb 25, 2024
2 parents ee58811 + d2226d7 commit a31657d
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 4 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# This is a basic workflow to help you get started with Actions
name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-2019

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Check Commit and Install 7Zip PowerShell Module
shell: powershell

run: |
# cancel early, if not build commit
$strVal ='${{ github.event.commits[0].message }}'
if($strVal -clike '*#GITBUILD*')
{
Write-Host 'True'
} else {
Write-Host 'False'
exit(1)
}
Install-Module 7Zip4PowerShell -Force -Verbose
- uses: actions/checkout@v2

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

- name: Build Binary
shell: cmd
run: call .\Build.cmd

- name: Build Artifact
shell: cmd
run: call .\ArtifactBuild.cmd

- name: Get current date and time
id: datetime
run: echo "::set-output name=current_datetime::$(date +'%d/%m/%Y %H:%M')"

- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{github.run_number}}
release_name: ${{ steps.datetime.outputs.current_datetime }} (${{ github.run_number }})
body: |
Automated Release by GitHub Action CI
draft: false
prerelease: false

- name: Upload Release Asset
id: 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: ./UnityLauncherPro.zip
asset_name: UnityLauncherPro.zip
asset_content_type: application/zip

6 changes: 6 additions & 0 deletions ArtifactBuild.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
pushd "%~dp0"
powershell Compress-7Zip "UnityLauncherPro\bin\Release\UnityLauncherPro.exe" -ArchiveFileName "UnityLauncherPro.zip" -Format Zip
:exit
popd
@echo on
11 changes: 11 additions & 0 deletions Build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off
pushd "%~dp0"
if exist Debug rd /s /q Debug
if exist Release rd /s /q Release
if exist x64 rd /s /q x64

"%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" /p:Configuration=Release

:exit
popd
@echo on
2 changes: 0 additions & 2 deletions UnityLauncherPro/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1990,8 +1990,6 @@ private void ChkAskNameForQuickProject_Checked(object sender, RoutedEventArgs e)
bool isInitializing = true; // used to avoid doing things while still starting up
private void ChkStreamerMode_Checked(object sender, RoutedEventArgs e)
{
if (this.IsActive == false) return; // dont run code on window init

var isChecked = (bool)((CheckBox)sender).IsChecked;

Settings.Default.streamerMode = isChecked;
Expand Down
12 changes: 10 additions & 2 deletions UnityLauncherPro/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,12 @@ public static void DownloadAndInstall(string url, string version)
if (DownloadFile(exeURL, tempFile) == true)
{
// get base version, to use for install path
string outputVersionFolder = "\\" + version.Split('.')[0] + "_" + version.Split('.')[1];
string targetPathArgs = " /D=" + Properties.Settings.Default.rootFolders[Properties.Settings.Default.rootFolders.Count - 1] + outputVersionFolder; ;
// FIXME check if have any paths?
string lastRootFolder = Properties.Settings.Default.rootFolders[Properties.Settings.Default.rootFolders.Count - 1];
// check if ends with / or \
if (lastRootFolder.EndsWith("/") == false && lastRootFolder.EndsWith("\\") == false) lastRootFolder += "/";
string outputVersionFolder = version.Split('.')[0] + "_" + version.Split('.')[1];
string targetPathArgs = " /D=" + lastRootFolder + outputVersionFolder; ;

// if user clicks NO to UAC, this fails (so added try-catch)
try
Expand Down Expand Up @@ -691,6 +695,7 @@ public static void DownloadInitScript(string currentInitScriptFullPath, string c
{
// check if file exists
if (File.Exists(currentInitScriptLocationOrURL) == false) return;

tempFile = currentInitScriptLocationOrURL;
isLocalFile = true;
}
Expand All @@ -705,6 +710,9 @@ public static void DownloadInitScript(string currentInitScriptFullPath, string c
var tempContent = File.ReadAllText(tempFile);
if (tempContent.IndexOf("public class InitializeProject") > 0 && tempContent.IndexOf("namespace UnityLauncherProTools") > 0 && tempContent.IndexOf("public static void Init()") > 0)
{
// create scripts folder if missing
if (Directory.Exists(currentInitScriptFolder) == false) Directory.CreateDirectory(currentInitScriptFolder);

// move old file as backup
if (File.Exists(currentInitScriptFullPath))
{
Expand Down

0 comments on commit a31657d

Please sign in to comment.