From 6627cf4c6b14022b1280f4d35798cf25916371e1 Mon Sep 17 00:00:00 2001 From: rankun Date: Fri, 21 Feb 2020 16:04:34 +0800 Subject: [PATCH] 1 --- .github/workflows/windows.yml | 49 ++++++++++------------------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2a59bf4..e35d9fd 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -22,7 +22,7 @@ jobs: strategy: # 矩阵配置 matrix: - qt_ver: [5.12.7] + qt_ver: [5.12.6] qt_target: [desktop] # mingw用不了 # qt_arch: [win64_msvc2017_64, win32_msvc2017, win32_mingw53,win32_mingw73] @@ -43,13 +43,13 @@ jobs: id: WindowsCacheQt uses: actions/cache@v1 with: - path: ../../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch_install}} - key: ${{ runner.os }}-cache-Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}} + path: ../../Qt5/${{matrix.qt_ver}}/${{matrix.qt_arch_install}} + key: ${{ runner.os }}-Qt5.12.6/${{matrix.qt_ver}}/${{matrix.qt_arch}} - name: Setup Qt if: steps.WindowsCacheQt.outputs.cache-hit == 'true' shell: pwsh env: - QtPath: ../../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch_install}} + QtPath: ../../Qt5/${{matrix.qt_ver}}/${{matrix.qt_arch_install}} run: | $qt_Path=${env:QtPath} echo "::set-env name=Qt5_Dir::$qt_Path" @@ -75,7 +75,7 @@ jobs: shell: cmd env: ENV_VCVARSALL: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat' - ENV_QT_MSVC: 'd:\a\Qt\5.12.7' + ENV_QT_MSVC: 'd:\a\Qt5\5.12.6' run: | call "ci\win\build_for_win.bat" release ${{ matrix.msvc_arch }} # tag 打包 @@ -96,9 +96,8 @@ jobs: echo "::set-env name=packageName::$name" # 打印环境变量packageName Write-Host 'packageName:'${env:packageName} - # tag 查询github-Release - - name: Query Release Win - id: queryReleaseWin + # 查询Release + - name: Query Release if: startsWith(github.event.ref, 'refs/tags/') shell: pwsh env: @@ -113,45 +112,23 @@ jobs: } catch { Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__ Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription - # 没查到,输出 - echo "::set-output name=needCreateRelease::true" - return + # 没查到 + return 1 } [string]$latestUpUrl = $response.upload_url Write-Host 'latestUpUrl:'$latestUpUrl if ($latestUpUrl.Length -eq 0) { - # 没查到,输出 - echo "::set-output name=needCreateRelease::true" + # 没查到 + return 1 } - # tag 创建github-Release - - name: Create Release Win - id: createReleaseWin - if: startsWith(github.event.ref, 'refs/tags/') && steps.queryReleaseWin.outputs.needCreateRelease == 'true' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions/create-release@v1.0.0 - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - body: ${{ github.event.head_commit.message }} - draft: false - prerelease: false - # 重定向upload_url到环境变量uploadUrl。 - - name: Get Latest Tag Release - # tag 上一步无论成功还是失败都执行 + # 获取上传url + - name: Get Release Url if: startsWith(github.event.ref, 'refs/tags/') shell: pwsh env: githubFullName: ${{ github.event.repository.full_name }} - upUrl: ${{ steps.createReleaseWin.outputs.upload_url }} ref: ${{ github.event.ref }} run: | - # upUrl不为空,导出就完事 - if (${env:upUrl}.Length -gt 0) { - $v=${env:upUrl} - echo "::set-env name=uploadUrl::$v" - return - } [string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1) [string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag} $response = Invoke-RestMethod -Uri $url -Method Get