Skip to content

Publish a Build of WiX Toolset v5 #13

Publish a Build of WiX Toolset v5

Publish a Build of WiX Toolset v5 #13

Workflow file for this run

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