Deploy head #17
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
name: "Deploy head" | |
on: | |
workflow_run: | |
workflows: | |
- Package | |
types: | |
- completed | |
branches: | |
- main | |
permissions: | |
contents: write | |
deployments: write | |
jobs: | |
check: | |
name: "Check skip" | |
runs-on: ubuntu-latest | |
outputs: | |
is_newer: ${{ steps.step1.outputs.result }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check agains head | |
id: step1 | |
shell: pwsh | |
run: | | |
git merge-base --is-ancestor refs/tags/head ${{ github.sha }} | |
echo "Result: $LASTEXITCODE" | |
if($LASTEXITCODE -eq 0) { | |
"result=1" | Out-File -Path $env:GITHUB_OUTPUT -Append | |
} | |
elseif($LASTEXITCODE -eq 1) { | |
"result=0" | Out-File -Path $env:GITHUB_OUTPUT -Append | |
exit 0 | |
} | |
tag: | |
name: "Update tag" | |
runs-on: ubuntu-latest | |
needs: check | |
if: needs.check.outputs.is_newer == 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update head tag | |
run: | | |
git push --delete origin head | |
git tag head | |
git push origin head | |
assets: | |
name: "Upload assets" | |
runs-on: ubuntu-latest | |
needs: check | |
if: needs.check.outputs.is_newer == 1 | |
steps: | |
- name: Download build artifact (vsix) | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
workflow: package.yml | |
run_id: ${{ github.event.workflow_run.id }} | |
name: childdebugger-win32-x64 | |
- name: Download build artifacts (tests) | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
workflow: package.yml | |
run_id: ${{ github.event.workflow_run.id }} | |
name: childdebugger-win32-x64-tests | |
skip_unpack: true | |
- name: Download build artifacts (debug symbols) | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
workflow: package.yml | |
run_id: ${{ github.event.workflow_run.id }} | |
name: childdebugger-win32-x64-debug-symbols | |
skip_unpack: true | |
- name: Upload release asset (vsix) | |
shell: pwsh | |
run: | | |
$assetId = curl -L ` | |
-H "Accept: application/vnd.github+json" ` | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" ` | |
-H "X-GitHub-Api-Version: 2022-11-28" ` | |
https://api.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/126145941/assets | ` | |
ConvertFrom-Json | ` | |
Where-Object -Property name -Value "childdebugger-win32-x64.vsix" -EQ | ` | |
Select-Object -Expand id | |
if($assetId) { | |
curl -L ` | |
-X DELETE ` | |
-H "Accept: application/vnd.github+json" ` | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"` | |
-H "X-GitHub-Api-Version: 2022-11-28" ` | |
https://api.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/assets/$assetId | |
} | |
curl -i -X POST ` | |
-H "Accept: application/vnd.github+json" ` | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" ` | |
-H "X-GitHub-Api-Version: 2022-11-28" ` | |
-H "Content-Type: application/zip" ` | |
--data-binary "@childdebugger-win32-x64.vsix" ` | |
"https://uploads.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/126145941/assets?name=childdebugger-win32-x64.vsix" | |
- name: Upload release asset (tests) | |
shell: pwsh | |
run: | | |
$assetId = curl -L ` | |
-H "Accept: application/vnd.github+json" ` | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" ` | |
-H "X-GitHub-Api-Version: 2022-11-28" ` | |
https://api.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/126145941/assets | ` | |
ConvertFrom-Json | ` | |
Where-Object -Property name -Value "childdebugger-win32-x64-tests.zip" -EQ | ` | |
Select-Object -Expand id | |
if($assetId) { | |
curl -L ` | |
-X DELETE ` | |
-H "Accept: application/vnd.github+json" ` | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"` | |
-H "X-GitHub-Api-Version: 2022-11-28" ` | |
https://api.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/assets/$assetId | |
} | |
curl -i -X POST ` | |
-H "Accept: application/vnd.github+json" ` | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" ` | |
-H "X-GitHub-Api-Version: 2022-11-28" ` | |
-H "Content-Type: application/zip" ` | |
--data-binary "@childdebugger-win32-x64-tests.zip" ` | |
"https://uploads.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/126145941/assets?name=childdebugger-win32-x64-tests.zip" | |
- name: Upload release asset (debug-sybols) | |
shell: pwsh | |
run: | | |
$assetId = curl -L ` | |
-H "Accept: application/vnd.github+json" ` | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" ` | |
-H "X-GitHub-Api-Version: 2022-11-28" ` | |
https://api.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/126145941/assets | ` | |
ConvertFrom-Json | ` | |
Where-Object -Property name -Value "childdebugger-win32-x64-debug-symbols.zip" -EQ | ` | |
Select-Object -Expand id | |
if($assetId) { | |
curl -L ` | |
-X DELETE ` | |
-H "Accept: application/vnd.github+json" ` | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"` | |
-H "X-GitHub-Api-Version: 2022-11-28" ` | |
https://api.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/assets/$assetId | |
} | |
curl -i -X POST ` | |
-H "Accept: application/vnd.github+json" ` | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" ` | |
-H "X-GitHub-Api-Version: 2022-11-28" ` | |
-H "Content-Type: application/zip" ` | |
--data-binary "@childdebugger-win32-x64-debug-symbols.zip" ` | |
"https://uploads.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/126145941/assets?name=childdebugger-win32-x64-debug-symbols.zip" | |
publish: | |
name: "Puplish" | |
runs-on: ubuntu-latest | |
needs: | |
- tag | |
- assets | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Mark release as non-draft | |
run: | | |
curl -L -X PATCH \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"https://api.github.com/repos/albertziegenhagel/childdebugger-vscode/releases/126145941" \ | |
-d '{"draft":false}' |