diff --git a/.github/workflows/WAU-AutoCreatePreVersion.yml b/.github/workflows/WAU-AutoCreatePreVersion.yml index b5d77d2..1037696 100644 --- a/.github/workflows/WAU-AutoCreatePreVersion.yml +++ b/.github/workflows/WAU-AutoCreatePreVersion.yml @@ -68,7 +68,7 @@ jobs: - name: Overwrite Version.txt file uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3 with: - path: Sources/WAU/Winget-AutoUpdate/Version.txt + path: Sources/Winget-AutoUpdate/Version.txt write-mode: overwrite contents: ${{ steps.versioning.outputs.version }} @@ -88,8 +88,8 @@ jobs: echo "### Extract MSI ###" 7z x MicrosoftDeploymentToolkit_x64.msi - echo "### Copy ServiceUI.exe to 'Sources/WAU/Winget-AutoUpdate' folder ###" - mv Modena_File206 Sources/WAU/Winget-AutoUpdate/ServiceUI.exe -v + echo "### Copy ServiceUI.exe to 'Sources/Winget-AutoUpdate' folder ###" + mv Modena_File206 Sources/Winget-AutoUpdate/ServiceUI.exe -v echo "### Go to Sources ###" cd Sources diff --git a/.github/workflows/WAU-CreateNewVersion.yml b/.github/workflows/WAU-CreateNewVersion.yml index d829715..12801be 100644 --- a/.github/workflows/WAU-CreateNewVersion.yml +++ b/.github/workflows/WAU-CreateNewVersion.yml @@ -31,7 +31,7 @@ jobs: lfs: "true" - name: Auto Increment Semver Action - uses: MCKanpolat/auto-semver-action@5003b8d37f4b03d95f15303ea10242cbf7c13141 # 2 + uses: MCKanpolat/auto-semver-action@5003b8d37f4b03d95f15303ea10242cbf7c13141 # 2 id: versioning with: releaseType: ${{ github.event.inputs.version }} @@ -39,14 +39,14 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} - name: Overwrite Version.txt file - uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3 + uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3 with: - path: Sources/WAU/Winget-AutoUpdate/Version.txt + path: Sources/Winget-AutoUpdate/Version.txt write-mode: overwrite contents: "${{ steps.versioning.outputs.version }}" - name: Commit & Push - uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 # v1.5 + uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 # v1.5 with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: main @@ -61,8 +61,8 @@ jobs: echo "### Extract MSI ###" 7z x MicrosoftDeploymentToolkit_x64.msi - echo "### Copy ServiceUI.exe to 'Sources/WAU/Winget-AutoUpdate' folder ###" - mv Modena_File206 Sources/WAU/Winget-AutoUpdate/ServiceUI.exe -v + echo "### Copy ServiceUI.exe to 'Sources/Winget-AutoUpdate' folder ###" + mv Modena_File206 Sources/Winget-AutoUpdate/ServiceUI.exe -v echo "### Go to Sources ###" cd Sources @@ -87,7 +87,7 @@ jobs: echo "Install counter file." > WAU_InstallCounter - name: Create release - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 with: tag: "v${{ steps.versioning.outputs.version }}" prerelease: ${{ github.event.inputs.pre-release }} diff --git a/Sources/WAU Configurator.ps1 b/Sources/WAU Configurator.bat similarity index 97% rename from Sources/WAU Configurator.ps1 rename to Sources/WAU Configurator.bat index a521f2a..fe86b2c 100644 --- a/Sources/WAU Configurator.ps1 +++ b/Sources/WAU Configurator.bat @@ -1,3 +1,10 @@ +@@:: This prolog allows a PowerShell script to be embedded in a .CMD file. +@@:: Any non-PowerShell content must be preceeded by "@@" +@@setlocal +@@set POWERSHELL_BAT_ARGS=%* +@@if defined POWERSHELL_BAT_ARGS set POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"% +@@PowerShell -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %POWERSHELL_BAT_ARGS%);'+[String]::Join([char]10,$((Get-Content '%~f0') -notmatch '^^@@'))) & goto :EOF + <# .SYNOPSIS Install and configure Winget-AutoUpdate @@ -21,7 +28,7 @@ if ( $psversionTable.PSEdition -eq "core" ) { import-Module -name Appx -UseWIndowsPowershell -WarningAction:SilentlyContinue } -$Script:WAUConfiguratorVersion = Get-Content "$PSScriptRoot\Winget-AutoUpdate\Version.txt" +$Script:WAUConfiguratorVersion = Get-Content ".\Winget-AutoUpdate\Version.txt" <# FUNCTIONS #> @@ -176,12 +183,12 @@ function Start-Installations { if ($WAUUseWhiteList) { $WAUParameters += "-UseWhiteList " if ($WAUListPath) { - Copy-Item $WAUListPath -Destination "$PSScriptRoot\included_apps.txt" -Force -ErrorAction SilentlyContinue + Copy-Item $WAUListPath -Destination ".\included_apps.txt" -Force -ErrorAction SilentlyContinue } } else { if ($WAUListPath) { - Copy-Item $WAUListPath -Destination "$PSScriptRoot\excluded_apps.txt" -Force -ErrorAction SilentlyContinue + Copy-Item $WAUListPath -Destination ".\excluded_apps.txt" -Force -ErrorAction SilentlyContinue } } if ($WAUDesktopShortcut) { @@ -195,7 +202,7 @@ function Start-Installations { } #Install Winget-Autoupdate - Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command ""& '$PSScriptRoot\Winget-AutoUpdate-Install.ps1' $WAUParameters""" -Wait -Verb RunAs + Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command ""& '.\Winget-AutoUpdate-Install.ps1' $WAUParameters""" -Wait -Verb RunAs } @@ -268,7 +275,7 @@ function Start-Uninstallations ($AppToUninstall) { #Run Winget-Install -Uninstall $AppsToUninstall = "'$($AppToUninstall -join "','")'" - Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `"$PSScriptRoot\Winget-AutoUpdate\Winget-Install.ps1 -AppIDs $AppsToUninstall -Uninstall`"" -Wait -Verb RunAs + Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `".\Winget-AutoUpdate\Winget-Install.ps1 -AppIDs $AppsToUninstall -Uninstall`"" -Wait -Verb RunAs Close-PopUp }