-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
iotang
committed
Feb 28, 2020
1 parent
399de3f
commit 444605d
Showing
2 changed files
with
9 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,79 +55,11 @@ jobs: | |
run: | | ||
# 拷贝依赖 | ||
macdeployqt ${targetName}.app -qmldir=. -verbose=1 -dmg | ||
# tag 查询github-Release | ||
- name: queryReleaseMacos | ||
id: queryReleaseMacos | ||
if: startsWith(github.event.ref, 'refs/tags/') | ||
shell: pwsh | ||
env: | ||
githubFullName: ${{ github.event.repository.full_name }} | ||
ref: ${{ github.event.ref }} | ||
run: | | ||
[string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1) | ||
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag} | ||
$response={} | ||
Write-Host "URL : " $url | ||
try { | ||
$response = Invoke-RestMethod -Uri $url -Method Get | ||
} catch { | ||
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__ | ||
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription | ||
# 没查到,输出 | ||
# echo "::set-output name=needCreateRelease::true" | ||
return | ||
} | ||
[string]$latestUpUrl = $response.upload_url | ||
Write-Host 'latestUpUrl:'$latestUpUrl | ||
if ($latestUpUrl.Length -eq 0) { | ||
# 没查到,输出 | ||
echo "::set-output name=needCreateRelease::true" | ||
} | ||
# tag 创建github-Release | ||
- name: createReleaseMacos | ||
id: createReleaseMacos | ||
if: startsWith(github.event.ref, 'refs/tags/') && steps.queryReleaseMacos.outputs.needCreateRelease == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: actions/[email protected] | ||
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/') | ||
shell: pwsh | ||
env: | ||
githubFullName: ${{ github.event.repository.full_name }} | ||
upUrl: ${{ steps.createReleaseMacos.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 | ||
[string]$latestUpUrl = $response.upload_url | ||
Write-Host 'latestUpUrl:'$latestUpUrl | ||
echo "::set-env name=uploadUrl::$latestUpUrl" | ||
Write-Host 'env uploadUrl:'${env:uploadUrl} | ||
# tag 上传Release | ||
- name: uploadRelease | ||
id: uploadRelease | ||
if: startsWith(github.event.ref, 'refs/tags/') | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: actions/[email protected] | ||
uses: svenstaro/upload-release-action@v1-release | ||
with: | ||
upload_url: ${{ env.uploadUrl }} | ||
asset_path: ./${{ env.targetName }}.dmg | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: ./${{ env.targetName }}.dmg | ||
asset_name: ${{ env.targetName }}.dmg | ||
asset_content_type: application/applefile | ||
tag: ${{ github.ref }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,79 +98,12 @@ jobs: | |
echo "::set-env name=packageName::$name" | ||
# 打印环境变量packageName | ||
Write-Host 'packageName:'${env:packageName} | ||
# tag 查询github-Release | ||
- name: queryReleaseWin | ||
id: queryReleaseWin | ||
if: startsWith(github.event.ref, 'refs/tags/') | ||
shell: pwsh | ||
env: | ||
githubFullName: ${{ github.event.repository.full_name }} | ||
ref: ${{ github.event.ref }} | ||
run: | | ||
[string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1) | ||
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag} | ||
$response={} | ||
Write-Host "URL : " $url | ||
try { | ||
$response = Invoke-RestMethod -Uri $url -Method Get | ||
} catch { | ||
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__ | ||
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription | ||
# 没查到,输出 | ||
echo "::set-output name=needCreateRelease::true" | ||
return | ||
} | ||
[string]$latestUpUrl = $response.upload_url | ||
Write-Host 'latestUpUrl:'$latestUpUrl | ||
if ($latestUpUrl.Length -eq 0) { | ||
# 没查到,输出 | ||
echo "::set-output name=needCreateRelease::true" | ||
} | ||
# tag 创建github-Release | ||
- name: createReleaseWin | ||
id: createReleaseWin | ||
if: startsWith(github.event.ref, 'refs/tags/') && steps.queryReleaseWin.outputs.needCreateRelease == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: actions/[email protected] | ||
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/') | ||
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 | ||
[string]$latestUpUrl = $response.upload_url | ||
Write-Host 'latestUpUrl:'$latestUpUrl | ||
echo "::set-env name=uploadUrl::$latestUpUrl" | ||
Write-Host 'env uploadUrl:'${env:uploadUrl} | ||
# tag 上传Release | ||
- name: uploadRelease | ||
id: uploadRelease | ||
if: startsWith(github.event.ref, 'refs/tags/') | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: actions/[email protected] | ||
uses: svenstaro/upload-release-action@v1-release | ||
with: | ||
upload_url: ${{ env.uploadUrl }} | ||
asset_path: ./${{ env.packageName }}.zip | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: ./${{ env.packageName }}.zip | ||
asset_name: ${{ env.packageName }}.zip | ||
asset_content_type: application/zip | ||
tag: ${{ github.ref }} | ||
overwrite: true |