mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 14:18:45 +00:00
1
This commit is contained in:
parent
755bf7c402
commit
6263f8a0fd
1 changed files with 21 additions and 35 deletions
56
.github/workflows/macos.yml
vendored
56
.github/workflows/macos.yml
vendored
|
@ -50,12 +50,20 @@ jobs:
|
||||||
ci/mac/build_for_mac.sh release
|
ci/mac/build_for_mac.sh release
|
||||||
# tag 打包
|
# tag 打包
|
||||||
- name: Package
|
- name: Package
|
||||||
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
run: |
|
run: |
|
||||||
|
# 组拼名称
|
||||||
|
[string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1)
|
||||||
|
[string]$name = 'QtScrcpy-mac-x64-' + ${tag} + '.zip'
|
||||||
|
# 打包
|
||||||
export ENV_QT_CLANG=$(pwd)/${{env.Qt5_Dir}}
|
export ENV_QT_CLANG=$(pwd)/${{env.Qt5_Dir}}
|
||||||
ci/mac/publish_for_mac.sh ../build
|
ci/mac/publish_for_mac.sh ../build
|
||||||
# tag 查询github-Release
|
# 压缩zip
|
||||||
- name: queryRelease
|
zip -r $name ../build/QtScrcpy.app
|
||||||
id: queryReleaseMacos
|
# 记录环境变量packageName给后续step
|
||||||
|
echo "::set-env name=packageName::$name"
|
||||||
|
# 查询Release
|
||||||
|
- name: Query Release
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
env:
|
env:
|
||||||
|
@ -70,45 +78,23 @@ jobs:
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
|
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
|
||||||
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
|
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
|
||||||
# 没查到,输出
|
# 没查到
|
||||||
echo "::set-output name=needCreateRelease::true"
|
return 1
|
||||||
return
|
|
||||||
}
|
}
|
||||||
[string]$latestUpUrl = $response.upload_url
|
[string]$latestUpUrl = $response.upload_url
|
||||||
Write-Host 'latestUpUrl:'$latestUpUrl
|
Write-Host 'latestUpUrl:'$latestUpUrl
|
||||||
if ($latestUpUrl.Length -eq 0) {
|
if ($latestUpUrl.Length -eq 0) {
|
||||||
# 没查到,输出
|
# 没查到
|
||||||
echo "::set-output name=needCreateRelease::true"
|
return 1
|
||||||
}
|
}
|
||||||
# tag 创建github-Release
|
# 获取上传url
|
||||||
- name: createReleaseWin
|
- name: Get Release Url
|
||||||
id: createReleaseWin
|
|
||||||
if: startsWith(github.event.ref, 'refs/tags/') && steps.queryReleaseMacos.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: getLatestTagRelease
|
|
||||||
# tag 上一步无论成功还是失败都执行
|
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
env:
|
env:
|
||||||
githubFullName: ${{ github.event.repository.full_name }}
|
githubFullName: ${{ github.event.repository.full_name }}
|
||||||
upUrl: ${{ steps.queryReleaseMacos.outputs.upload_url }}
|
|
||||||
ref: ${{ github.event.ref }}
|
ref: ${{ github.event.ref }}
|
||||||
run: |
|
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]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1)
|
||||||
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag}
|
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag}
|
||||||
$response = Invoke-RestMethod -Uri $url -Method Get
|
$response = Invoke-RestMethod -Uri $url -Method Get
|
||||||
|
@ -117,7 +103,7 @@ jobs:
|
||||||
echo "::set-env name=uploadUrl::$latestUpUrl"
|
echo "::set-env name=uploadUrl::$latestUpUrl"
|
||||||
Write-Host 'env uploadUrl:'${env:uploadUrl}
|
Write-Host 'env uploadUrl:'${env:uploadUrl}
|
||||||
# tag 上传Release
|
# tag 上传Release
|
||||||
- name: uploadRelease
|
- name: Upload Release
|
||||||
id: uploadRelease
|
id: uploadRelease
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
env:
|
env:
|
||||||
|
@ -125,6 +111,6 @@ jobs:
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
uses: actions/upload-release-asset@v1.0.1
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ env.uploadUrl }}
|
upload_url: ${{ env.uploadUrl }}
|
||||||
asset_path: ./bin/${{ env.targetName }}.dmg
|
asset_path: ci\build\${{ env.packageName }}
|
||||||
asset_name: ${{ env.targetName }}.dmg
|
asset_name: ${{ env.packageName }}
|
||||||
asset_content_type: application/applefile
|
asset_content_type: application/zip
|
Loading…
Add table
Add a link
Reference in a new issue