forked from wixtoolset/wix
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (49 loc) · 2.09 KB
/
publish-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Publish a Build of WiX Toolset v5
on:
workflow_dispatch:
inputs:
run_id:
description: 'Build ID'
required: true
type: string
jobs:
build:
name: Publish
runs-on: windows-2022
steps:
- name: Resolve build commit
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
$buildSha = (gh run view "${{ github.event.inputs.run_id }}" --json headSha --jq ".headSha" --repo "${{ github.repositoryUrl }}") | Out-String
Write-Host ("Build SHA is " + $buildSha)
if ($buildSha -notmatch '[0-9a-fA-F]{40}') {
exit 1
}
Add-Content -Path ${{ github.env }} -Value ("BUILD_SHA=" + $buildSha)
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ env.BUILD_SHA }}
- name: Download build artifact
env:
GH_TOKEN: ${{ github.token }}
run: |
gh run download "${{ github.event.inputs.run_id }}" --name artifacts
- name: Resolve build version
run: |
$sdkFileName = Get-Childitem –Path "PanelSwWix4.Sdk.*.nupkg" -Name
$sdkFileName = $sdkFileName.Replace("PanelSwWix4.Sdk.", "");
$sdkFileName = $sdkFileName.Replace(".nupkg", "");
Add-Content -Path ${{ github.env }} -Value ("WIX_VERSION=" + $sdkFileName)
- name: Publish nuget packages to github
if: ${{ env.WIX_VERSION != '' }}
env:
GITHUB_TOKEN: ${{ secrets.TAGGER_PAT }}
run: |
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
dotnet nuget push "PanelSwWix4.*.${{ env.WIX_VERSION }}.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source github
dotnet nuget push "PanelSwWix4.*.${{ env.WIX_VERSION }}.nupkg" --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
git tag v${{ env.WIX_VERSION }}
git push --tags