mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 06:08:39 +00:00
chore: update macos.yml
This commit is contained in:
parent
5722d37d0b
commit
afabd128ab
1 changed files with 7 additions and 68 deletions
75
.github/workflows/macos.yml
vendored
75
.github/workflows/macos.yml
vendored
|
@ -69,77 +69,16 @@ jobs:
|
||||||
[string]$name = 'QtScrcpy-mac-x64-' + ${tag}
|
[string]$name = 'QtScrcpy-mac-x64-' + ${tag}
|
||||||
# 打包zip
|
# 打包zip
|
||||||
Compress-Archive -Path ci\build\QtScrcpy.dmg ci\build\${name}.zip
|
Compress-Archive -Path ci\build\QtScrcpy.dmg ci\build\${name}.zip
|
||||||
# 查询Release
|
|
||||||
- name: Query Release
|
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
githubFullName: ${{ github.event.repository.full_name }}
|
|
||||||
ref: ${{ github.event.ref }}
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
[string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1)
|
|
||||||
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag}
|
|
||||||
|
|
||||||
$token = ${env:github_token}
|
|
||||||
$authInfo = ("{0}" -f $token)
|
|
||||||
$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)
|
|
||||||
$authInfo = [System.Convert]::ToBase64String($authInfo)
|
|
||||||
$headers = @{Authorization=("barry-ran {0}" -f $authInfo)}
|
|
||||||
|
|
||||||
$response={}
|
|
||||||
try {
|
|
||||||
$response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
|
|
||||||
} catch {
|
|
||||||
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
|
|
||||||
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
|
|
||||||
# 没查到
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
[string]$latestUpUrl = $response.upload_url
|
|
||||||
Write-Host 'latestUpUrl:'$latestUpUrl
|
|
||||||
if ($latestUpUrl.Length -eq 0) {
|
|
||||||
# 没查到
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
# 获取上传url
|
|
||||||
- name: Get Release Url
|
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
githubFullName: ${{ github.event.repository.full_name }}
|
|
||||||
ref: ${{ github.event.ref }}
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
[string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1)
|
|
||||||
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag}
|
|
||||||
|
|
||||||
# github token防止api rate limite,否则一个小时只能60个api请求
|
|
||||||
$token = ${env:github_token}
|
|
||||||
$authInfo = ("{0}" -f $token)
|
|
||||||
$authInfo = [System.Text.Encoding]::UTF8.GetBytes($authInfo)
|
|
||||||
$authInfo = [System.Convert]::ToBase64String($authInfo)
|
|
||||||
$headers = @{Authorization=("barry-ran {0}" -f $authInfo)}
|
|
||||||
|
|
||||||
$response = Invoke-RestMethod -Uri $url -ContentType 'text/json' -Headers $headers -Method Get
|
|
||||||
[string]$latestUpUrl = $response.upload_url
|
|
||||||
Write-Host 'latestUpUrl:'$latestUpUrl
|
|
||||||
echo "::set-env name=uploadUrl::$latestUpUrl"
|
|
||||||
Write-Host 'env uploadUrl:'${env:uploadUrl}
|
|
||||||
[string]$name = 'QtScrcpy-mac-x64-' + ${tag}
|
|
||||||
# 记录环境变量packageName给后续step
|
# 记录环境变量packageName给后续step
|
||||||
echo "::set-env name=packageName::$name"
|
echo "::set-env name=packageName::$name"
|
||||||
# 打印环境变量packageName
|
# 打印环境变量packageName
|
||||||
Write-Host 'packageName:'${env:packageName}
|
Write-Host 'packageName:'${env:packageName}
|
||||||
# tag 上传Release
|
- name: Release
|
||||||
- name: Upload Release
|
uses: softprops/action-gh-release@v1
|
||||||
id: uploadRelease
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ env.uploadUrl }}
|
files: ci/build/${{ env.packageName }}.zip
|
||||||
asset_path: ci/build/${{ env.packageName }}.zip
|
name: ${{ env.packageName }}.zip
|
||||||
asset_name: ${{ env.packageName }}.zip
|
env:
|
||||||
asset_content_type: application/zip
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
Loading…
Add table
Add a link
Reference in a new issue