Skip to content

Updates workflow.

Updates workflow. #13

Workflow file for this run

name: CI
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup wix
run: |
dotnet.exe tool install --global wix
wix.exe extension add WixToolset.UI.wixext --global
nuget.exe install WixToolset.Heat -NonInteractive
Get-ChildItem -Path .\WixToolset.Heat* -Recurse |
Where-Object { $_.FullName.EndsWith('x64\heat.exe') } |
Select-Object -ExpandProperty DirectoryName |
Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Generate module manifest and version properties
id: version
run: |
New-Item ./publish -ItemType Directory -ErrorAction Stop |Out-Null
if ('${{ github.ref_type }}' -eq 'tag')
{
$tag = "${{ github.ref_name }}".TrimStart("v")
./src/ModuleManifest.ps1 -Path ./publish/PSSerilog.psd1 -Verbose -ErrorAction Stop
./src/VersionInfo.ps1 -Verbose -ErrorAction Stop
}
else
{
$tag = '0.0.1'
./src/ModuleManifest.ps1 -Version $tag -Path ./publish/PSSerilog.psd1 -Verbose -ErrorAction Stop
./src/VersionInfo.ps1 -Version $tag -Verbose -ErrorAction Stop
}
$version = [version]::new($tag)
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Clean solution
run: dotnet.exe clean .\src\PSSerilog.sln --configuration Release
- name: Build project
run: dotnet.exe publish .\src\PSSerilog\PSSerilog.csproj --configuration Release --runtime win-x64 --output .\publish
- name: Prepare release
run: Remove-Item ./publish/* -Include *.pdb,*.xml -ErrorAction Stop
- name: Generate PowerShell help
run: |
Install-Module -Name platyPS -Force -Confirm:$false -ErrorAction Stop
Import-Module ./publish/PSSerilog.psd1 -ErrorAction Stop
Update-MarkdownHelp ./docs -UpdateInputOutput -Force -ErrorAction Stop
New-ExternalHelp ./docs -OutputPath ./publish -ErrorAction Stop
- name: Harvest installer
run: |
heat.exe `
dir `
.\publish `
-nologo `
-cg ProductComponents `
-dr INSTALLDIR `
-var var.ProductSource `
-g1 `
-ag `
-ke `
-srd `
-sfrag `
-sreg `
-o Fragment.wxs
- name: Build installer
run: |
wix.exe `
build `
-arch x64 `
-src Fragment.wxs src\Product.wxs `
-d ProductSource=publish `
-d ProductVersion="${{ steps.version.outputs.version }}" `
-ext WixToolset.UI.wixext `
-out ps-serilog.msi
- name: Update installer
run: |
$path = Resolve-Path 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\msiinfo.exe' -ErrorAction Stop
& $path ps-serilog.msi -t "PowerShell Serilog Module" -o "PSSerilog v${{ steps.version.outputs.version }}"
- name: Validate installer
run: wix.exe msi validate ps-serilog.msi
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ps-serilog
path: |
./docs/
./ps-serilog.msi
if-no-files-found: error
- name: Install msi
run: |
$process = Start-Process msiexec.exe -ArgumentList '/i','ps-serilog.msi','/qn' -Wait -NoNewWindow -PassThru -ErrorAction Stop
if ($process.ExitCode -ne 0)
{
throw 'Non zero exit code: "{0}".' -f $process.ExitCode
}
- name: Test module
shell: powershell
run: |
$PSVersionTable
$logger = New-SerilogLoggerConfiguration |Add-SerilogSinkConsole |New-SerilogLogger |Set-SerilogDefaultLogger
$logger.Information('Hello world!')
Close-SerilogDefaultLogger
- name: Publish release
if: github.ref_type == 'tag'
uses: ncipollo/release-action@v1
with:
artifacts: ps-serilog.msi