From 5e97c6696dd1f3d55f3d27e18142a1ae6ff1dec5 Mon Sep 17 00:00:00 2001 From: Mentalflow <312902918@qq.com> Date: Thu, 9 May 2024 22:34:08 +0800 Subject: [PATCH] Workflows and Script: Optimize the workflow. --- .github/workflows/app_build_workflow.yml | 8 ++++---- scripts/windows-mingw-publish.ps1 | 13 ++++--------- scripts/windows-publish.ps1 | 23 ++++------------------- 3 files changed, 12 insertions(+), 32 deletions(-) diff --git a/.github/workflows/app_build_workflow.yml b/.github/workflows/app_build_workflow.yml index 4d6eee7..4db86a1 100644 --- a/.github/workflows/app_build_workflow.yml +++ b/.github/workflows/app_build_workflow.yml @@ -304,7 +304,7 @@ jobs: archiveName: ${{ env.APP_NAME }}_${{ env.QT_ARCH_WIN_MINGW }}_Qt${{ env.QT_VERSION }}_shared_${{ env.RELEASE_OR_NIGHTLY }} shell: pwsh run: | - & scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:APP_NAME}.exe + & scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:APP_NAME}.exe ${env:REPO_NAME} $name = ${env:archiveName} echo "packageName=$name" >> $env:GITHUB_OUTPUT @@ -360,7 +360,7 @@ jobs: archiveName: ${{ env.APP_NAME }}_${{ env.QT_ARCH_WIN_MINGW }}_Qt${{ env.QT_VERSION }}_static_${{ env.RELEASE_OR_NIGHTLY }} shell: pwsh run: | - & scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:APP_NAME}.exe + & scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:APP_NAME}.exe ${env:REPO_NAME} $name = ${env:archiveName} echo "packageName=$name" >> $env:GITHUB_OUTPUT @@ -422,7 +422,7 @@ jobs: msvcArch: ${{ env.QT_MSVC_ARCH }} shell: pwsh run: | - & scripts\windows-publish.ps1 ${env:archiveName} ${env:APP_NAME}.exe + & scripts\windows-publish.ps1 ${env:archiveName} ${env:APP_NAME}.exe ${env:REPO_NAME} $name = ${env:archiveName} echo "packageName=$name" >> $env:GITHUB_OUTPUT @@ -484,7 +484,7 @@ jobs: msvcArch: ${{ env.QT_MSVC_ARCH }} shell: pwsh run: | - & scripts\windows-publish.ps1 ${env:archiveName} ${env:APP_NAME}.exe + & scripts\windows-publish.ps1 ${env:archiveName} ${env:APP_NAME}.exe ${env:REPO_NAME} $name = ${env:archiveName} echo "packageName=$name" >> $env:GITHUB_OUTPUT diff --git a/scripts/windows-mingw-publish.ps1 b/scripts/windows-mingw-publish.ps1 index a7108b3..890fbd3 100644 --- a/scripts/windows-mingw-publish.ps1 +++ b/scripts/windows-mingw-publish.ps1 @@ -1,12 +1,7 @@ [CmdletBinding()] param ( - [string] $archiveName, [string] $APP_NAME + [string] $archiveName, [string] $APP_NAME, [string] $REPO_NAME ) -# 外部环境变量包括: -# archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }} - - -# archiveName: 5.15.2-win64_mingw81 $scriptDir = $PSScriptRoot $currentDir = Get-Location @@ -17,7 +12,7 @@ function Main() { New-Item -ItemType Directory $archiveName # 拷贝exe - Copy-Item D:\a\RibbonUI\RibbonUI\build\app\release\* $archiveName\ -Force -Recurse | Out-Null + Copy-Item D:\a\$REPO_NAME\$REPO_NAME\build\app\release\* $archiveName\ -Force -Recurse | Out-Null # 拷贝依赖 windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$APP_NAME # 删除不必要的文件 @@ -27,8 +22,8 @@ function Main() { Compress-Archive -Path $archiveName $archiveName'.zip' } -if ($null -eq $archiveName || $null -eq $APP_NAME) { - Write-Host "args missing, archiveName is" $archiveName ", APP_NAME is" $APP_NAME +if ($null -eq $archiveName || $null -eq $APP_NAME || $null -eq $REPO_NAME) { + Write-Host "args missing, archiveName is" $archiveName ", APP_NAME is" $APP_NAME ", REPO_NAME is" $REPO_NAME return } Main diff --git a/scripts/windows-publish.ps1 b/scripts/windows-publish.ps1 index f95e4ca..1717017 100644 --- a/scripts/windows-publish.ps1 +++ b/scripts/windows-publish.ps1 @@ -1,22 +1,7 @@ [CmdletBinding()] param ( - [string] $archiveName, [string] $APP_NAME + [string] $archiveName, [string] $APP_NAME, [string] $REPO_NAME ) -# 外部环境变量包括: -# archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }} -# winSdkDir: ${{ steps.build.outputs.winSdkDir }} -# winSdkVer: ${{ steps.build.outputs.winSdkVer }} -# vcToolsInstallDir: ${{ steps.build.outputs.vcToolsInstallDir }} -# vcToolsRedistDir: ${{ steps.build.outputs.vcToolsRedistDir }} -# msvcArch: ${{ matrix.msvc_arch }} - - -# winSdkDir: C:\Program Files (x86)\Windows Kits\10\ -# winSdkVer: 10.0.19041.0\ -# vcToolsInstallDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\ -# vcToolsRedistDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.28.29325\ -# archiveName: 5.9.9-win32_msvc2015 -# msvcArch: x86 $scriptDir = $PSScriptRoot $currentDir = Get-Location @@ -27,7 +12,7 @@ function Main() { New-Item -ItemType Directory $archiveName # 拷贝exe - Copy-Item D:\a\RibbonUI\RibbonUI\build\app\release\* $archiveName\ -Force -Recurse | Out-Null + Copy-Item D:\a\$REPO_NAME\$REPO_NAME\build\app\release\* $archiveName\ -Force -Recurse | Out-Null # 拷贝依赖 windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$APP_NAME # 删除不必要的文件 @@ -43,8 +28,8 @@ function Main() { Compress-Archive -Path $archiveName $archiveName'.zip' } -if ($null -eq $archiveName || $null -eq $APP_NAME) { - Write-Host "args missing, archiveName is" $archiveName ", APP_NAME is" $APP_NAME +if ($null -eq $archiveName || $null -eq $APP_NAME || $null -eq $REPO_NAME) { + Write-Host "args missing, archiveName is" $archiveName ", APP_NAME is" $APP_NAME ", REPO_NAME is" $REPO_NAME return } Main