Skip to content

Merge pull request #598 from LogExperts/nuget_license_packaged_compon… #4

Merge pull request #598 from LogExperts/nuget_license_packaged_compon…

Merge pull request #598 from LogExperts/nuget_license_packaged_compon… #4

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
runs-on: windows-latest
name: Build and Release ${{ github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for GitVersion to compute version from tags
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Install InnoSetup
run: choco install innosetup --no-progress -y
- name: Build and Package
run: ./build.ps1 --target Clean Pack --configuration Release
- name: Install nuget-license tool
run: dotnet tool install --global nuget-license
- name: Update usedComponents.json
shell: pwsh
run: |
# Generate updated component list (packages already restored by build).
# -override supplies license info for packages whose nuspec omits it (e.g. Nuke.GitHub),
# which otherwise makes nuget-license exit non-zero.
$output = nuget-license -i src/LogExpert.sln -o JsonPretty -override "src/Solution Items/nuget-license-overrides.json"
if ($LASTEXITCODE -ne 0) {
Write-Host "::error::nuget-license failed with exit code $LASTEXITCODE"
Write-Host $output
exit 1
}
Set-Content -Path "src/Solution Items/usedComponents.json" -Value $output -Encoding UTF8
- name: Commit generated files to Development
shell: pwsh
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Save generated files before switching branches (checkout would overwrite them)
$tempComponents = [System.IO.Path]::GetTempFileName()
$tempHashes = [System.IO.Path]::GetTempFileName()
Copy-Item "src/Solution Items/usedComponents.json" $tempComponents
Copy-Item "src/PluginRegistry/PluginHashGenerator.Generated.cs" $tempHashes
# Switch to Development and apply both updates
git fetch origin Development
git checkout Development
Copy-Item $tempComponents "src/Solution Items/usedComponents.json"
Copy-Item $tempHashes "src/PluginRegistry/PluginHashGenerator.Generated.cs"
git add "src/Solution Items/usedComponents.json"
git add "src/PluginRegistry/PluginHashGenerator.Generated.cs"
git diff --staged --quiet
if ($LASTEXITCODE -ne 0) {
git commit -m "chore: update plugin hashes and usedComponents.json for ${{ github.ref_name }} [skip ci]"
git push origin Development
} else {
Write-Host "No changes to commit"
}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
bin/LogExpert-Setup-*.exe
bin/LogExpert.*.zip
bin/LogExpert.ColumnizerLib.*.nupkg
bin/SftpFileSystem.x64.*.zip
bin/SftpFileSystem.x86.*.zip
bin/chocolatey/logexpert.*.nupkg
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}