From 6a5ccd965a7d7359623d38b5acc6318ab2698a6c Mon Sep 17 00:00:00 2001 From: jared Date: Fri, 18 Dec 2020 13:27:41 +0800 Subject: [PATCH] update ci --- .github/workflows/macos-11_0.yml | 30 +++++++++++++++--------------- .github/workflows/macos.yml | 6 +++++- .github/workflows/windows.yml | 30 +++++++++--------------------- scripts/windows-publish.ps1 | 31 +++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 37 deletions(-) create mode 100644 scripts/windows-publish.ps1 diff --git a/.github/workflows/macos-11_0.yml b/.github/workflows/macos-11_0.yml index 65220742..a0b4638b 100644 --- a/.github/workflows/macos-11_0.yml +++ b/.github/workflows/macos-11_0.yml @@ -49,19 +49,19 @@ jobs: qmake make # tag 打包 - - name: package - if: startsWith(github.event.ref, 'refs/tags/') - run: | - # 拷贝依赖 - macdeployqt bin/release/${targetName}.app -qmldir=. -verbose=1 -dmg + # - name: package + # if: startsWith(github.event.ref, 'refs/tags/') + # run: | + # # 拷贝依赖 + # macdeployqt bin/release/${targetName}.app -qmldir=. -verbose=1 -dmg - # tag 上传Release - - name: uploadRelease - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: bin/release/${{ env.targetName }}.dmg - asset_name: ${{ env.targetName }}-${{ matrix.os }}-${{ matrix.qt_ver }}.dmg - tag: ${{ github.ref }} - overwrite: true + # # tag 上传Release + # - name: uploadRelease + # if: startsWith(github.event.ref, 'refs/tags/') + # uses: svenstaro/upload-release-action@v2 + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # file: bin/release/${{ env.targetName }}.dmg + # asset_name: ${{ env.targetName }}-${{ matrix.os }}-${{ matrix.qt_ver }}.dmg + # tag: ${{ github.ref }} + # overwrite: true diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a3ffc956..157c7339 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -50,7 +50,11 @@ jobs: run: | # 拷贝依赖 macdeployqt bin/release/${targetName}.app -qmldir=. -verbose=1 -dmg - + # 上传artifacts + - uses: actions/upload-artifact@v2 + with: + name: ${targetName}.zip + path: bin/release/${targetName}.app # tag 上传Release - name: uploadRelease if: startsWith(github.event.ref, 'refs/tags/') diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 961955ae..d953ac6d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -60,6 +60,7 @@ jobs: qt_arch_install: msvc2019_64 env: targetName: TaoQuickShow.exe + VCINSTALLDIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC' # 步骤 steps: # 安装Qt @@ -81,10 +82,8 @@ jobs: # 编译msvc - name: build-msvc shell: cmd - env: - vc_arch: ${{ matrix.msvc_arch }} run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %vc_arch% + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }} qmake nmake # tag 打包 @@ -96,26 +95,15 @@ jobs: archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }} shell: pwsh run: | - # 创建文件夹 - New-Item -ItemType Directory ${env:archiveName} - # 拷贝exe - Copy-Item bin\release\${env:targetName} ${env:archiveName}\ - Copy-Item bin\release\Trans ${env:archiveName}\Trans -Recurse - # 拷贝依赖 - windeployqt --qmldir . ${env:archiveName}\${env:targetName} - # 删除不必要的库 - $excludeList=@("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb") - Remove-Item -Path Qml -Include $excludeList -Recurse -Force - # 打包zip - Compress-Archive -Path ${env:archiveName} ${env:archiveName}'.zip' + & scripts\windows-publish.ps1 ${env.archiveName} ${env.targetName} # 记录packageName给后续step - $name = ${env:archiveName} - echo "::set-output name=packageName::$name" + $name = ${env:archiveName} + echo "::set-output name=packageName::$name" # 上传artifacts - # - uses: actions/upload-artifact@v2 - # with: - # name: ${{ steps.package.outputs.packageName }} - # path: ${{ steps.package.outputs.packageName }}.zip + - uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package.outputs.packageName }} + path: ${{ steps.package.outputs.packageName }}.zip # tag 上传Release - name: uploadRelease if: startsWith(github.event.ref, 'refs/tags/') diff --git a/scripts/windows-publish.ps1 b/scripts/windows-publish.ps1 new file mode 100644 index 00000000..879f9d42 --- /dev/null +++ b/scripts/windows-publish.ps1 @@ -0,0 +1,31 @@ +$scriptDir=$PSScriptRoot +$currentDir=Get-Location +Write-Host "currentDir" $currentDir +Write-Host "scriptDir" $scriptDir + + +function Main() { + if ($args.Length -le 1 ) { + Write-Host "args missing, need at last 2, real " $args.Length + return + } + + [string]$archiveName=$args[0] + [string]$targetName=$args[1] + + New-Item -ItemType Directory $archiveName + # 拷贝exe + Copy-Item bin\release\$targetName $archiveName\ + Copy-Item bin\release\Trans $archiveName\Trans -Recurse + # 拷贝依赖 + windeployqt --qmldir . $archiveName\$targetName + # 删除不必要的库 + #$excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb") + #Remove-Item -Path Qml -Include $excludeList -Recurse -Force + # 打包zip + Compress-Archive -Path $archiveName $archiveName'.zip' +} + +Main $args + +