Build OpenNetMeter MSI and Push to Single Draft Release #37
This file contains hidden or 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: Build OpenNetMeter MSI and Push to Single Draft Release | |
| on: | |
| workflow_dispatch: | |
| # Give the release-action permission to create/update releases & assets | |
| permissions: | |
| contents: write | |
| jobs: | |
| draft-msi: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Setup .NET 8 | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore & Build Release | |
| run: | | |
| dotnet restore .\OpenNetMeter.sln | |
| dotnet build .\OpenNetMeter.sln --configuration Release --no-restore | |
| - name: Find built MSI | |
| id: find_msi | |
| shell: pwsh | |
| run: | | |
| $msi = Get-ChildItem ` | |
| "$Env:GITHUB_WORKSPACE\Installer\bin\x64\Release\en-us" ` | |
| -Filter 'OpenNetMeter-*.msi' ` | |
| | Select-Object -First 1 | |
| if (-not $msi) { throw '❌ No MSI found!' } | |
| # Properly set the output so it can be consumed later: | |
| "msi_path=$($msi.FullName)" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| - name: Create or Update Draft Release & Upload MSI | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: opennetmeter-draft | |
| name: OpenNetMeter (Draft Release) | |
| draft: true | |
| allowUpdates: true | |
| artifacts: ${{ steps.find_msi.outputs.msi_path }} | |
| - name: Echo MSI path | |
| shell: pwsh | |
| env: | |
| MSI_PATH: ${{ steps.find_msi.outputs.msi_path }} | |
| run: | | |
| Write-Host "Built MSI path was: $Env:MSI_PATH" |