Skip to content

Generating InstallerLib NuGet package #103

Generating InstallerLib NuGet package

Generating InstallerLib NuGet package #103

Workflow file for this run

name: Build
on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches-ignore:
- 'gh-pages'
env:
# set RestoreUseSkipNonexistentTargets=false so running "nuget.exe restore dni.sln" returns a successful exit code (0).
# Otherwise, the following errors occur:
# .\Samples\PackagedSetup\Simple\Simple.vdproj(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1. [dni.proj]
# EXEC : warning : Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored. [dni.proj]
# dni.proj(130,5): error MSB3073: The command "ThirdParty\NuGet\NuGet.exe restore Dni.sln" exited with code -1.
RestoreUseSkipNonexistentTargets: false
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
jobs:
build:
runs-on: windows-2019
strategy:
matrix:
Configuration: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Download Win8.1 SDK
shell: powershell
run: |
md C:\win81sdk
Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=323507 -OutFile C:\win81sdk\sdksetup.exe -UseBasicParsing
- name: Install Win8.1 SDK
shell: powershell
run: |
Start-Process -Wait C:\win81sdk\sdksetup.exe -ArgumentList "/q", "/norestart", "/features", "OptionId.WindowsDesktopSoftwareDevelopmentKit", "OptionId.NetFxSoftwareDevelopmentKit"
- name: Install Microsoft Visual C++ 2010 Runtime 10.0.40219
# This is required for the test method 'testGetRelatedInstalledProducts' in 'dotNetInstallerToolsLibUnitTests\MsiUtilUnitTests.cpp' to succeed.
# The windows-2016 virtual environment has an older version, Microsoft Visual C++ 2010 Runtime 10.0.30319.
run: choco install vcredist2010 --version=10.0.40219.32503
- name: Install .NET 6 SDK
run: |
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
.\dotnet-install.ps1 -Version 6.0.413 -Architecture "x64" -InstallDir "C:\Program Files\dotnet" -NoPath -Verbose
- name: dotnet version and info
shell: cmd
run: |
"C:\Program Files\dotnet\dotnet.exe" --version
"C:\Program Files\dotnet\dotnet.exe" --info
- name: Configure Windows Error Reporting
shell: cmd
run: |
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_EXPAND_SZ /v DumpFolder /d "${{ github.workspace }}\CrashDumps" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_DWORD /v DumpCount /d 10 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_DWORD /v DumpType /d 2 /f
reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_EXPAND_SZ /v DumpFolder /d "${{ github.workspace }}\CrashDumps" /f
reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_DWORD /v DumpCount /d 10 /f
reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_DWORD /v DumpType /d 2 /f
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /t:all /binaryLogger /verbosity:diagnostic /m /p:Configuration=${{ matrix.Configuration }} .\dni.proj
- name: Read versions from files
run: |
$version = Get-Content -Path .\Version\version.txt
echo "VERSION=$version" >> $env:GITHUB_ENV
$nuget_version = Get-Content -Path .\Version\nuget_version.txt
echo "NUGET_VERSION=$nuget_version" >> $env:GITHUB_ENV
- name: Write versions to output
run: |
echo "The build version is ${{ env.VERSION }}"
echo "The NuGet version is ${{ env.NUGET_VERSION }}"
- name: Dump environment variables
if: always()
shell: cmd
run: set
- name: Publish Failed Test Results Report
if: github.event_name != 'pull_request'
uses: dorny/test-reporter@v1
with:
name: Tests
path: TestResults/*.trx
reporter: dotnet-trx
list-suites: 'failed'
list-tests: 'failed'
max-annotations: 50
- name: Export Windows Event Logs
if: failure()
shell: cmd
run: |
wevtutil epl Application Application.evtx
wevtutil epl Security Security.evtx
wevtutil epl System System.evtx
- name: Upload Test Result Files
if: always()
uses: actions/upload-artifact@v4
with:
name: TestResults-${{ matrix.Configuration }}
path: |
.\**\TestResults\**\*
.\InstallerEditor\**\*.png
.\*.evtx
.\CrashDumps\**\*
# Upload the temp files separately.
# Otherwise the following error occurs:
# The rootDirectory: "D:\a\dotnetinstaller\dotnetinstaller" is not a parent directory of the file: "C:\Users\runneradmin\AppData\Local\Temp\33fcd148-d0c7-46cd-8333-9b21a22d2d2c.xml"
- name: Upload Temp Files
if: failure()
uses: actions/upload-artifact@v4
with:
name: TempLogs-${{ matrix.Configuration }}
path: |
C:\Users\runneradmin\AppData\Local\Temp\*.exe
C:\Users\runneradmin\AppData\Local\Temp\*.log
C:\Users\runneradmin\AppData\Local\Temp\*.txt
C:\Users\runneradmin\AppData\Local\Temp\*.xml
- name: Upload Build Artifact - MSBuild Log
uses: actions/upload-artifact@v4
with:
name: msbuild.${{ env.VERSION }}.${{ matrix.Configuration }}.binlog
path: msbuild.binlog
if-no-files-found: error
- name: Upload Build Artifact - Zip
uses: actions/upload-artifact@v4
with:
name: dotNetInstaller.${{ env.VERSION }}.${{ matrix.Configuration }}.zip
path: .\target\${{ matrix.Configuration }}\dotNetInstaller.${{ env.VERSION }}.zip
if-no-files-found: error
- name: Upload Build Artifact - Msi
uses: actions/upload-artifact@v4
with:
name: dotNetInstaller.${{ env.VERSION }}.${{ matrix.Configuration }}.msi
path: .\target\${{ matrix.Configuration }}\dotNetInstaller.${{ env.VERSION }}.msi
if-no-files-found: error
- name: Upload Build Artifact - NuGet Package
uses: actions/upload-artifact@v4
with:
name: dotNetInstaller.${{ env.NUGET_VERSION }}.${{ matrix.Configuration }}.nupkg
path: .\target\${{ matrix.Configuration }}\InstallerLib.${{ env.NUGET_VERSION }}.nupkg
if-no-files-found: error
- name: Publish NuGet package
if: github.event_name != 'pull_request' && matrix.Configuration == 'Release' && env.NUGET_API_KEY != ''
shell: pwsh
run: |
dotnet nuget push .\target\${{ matrix.Configuration }}\InstallerLib.${{ env.NUGET_VERSION }}.nupkg -k ${{ env.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json