Ci actions #2
Workflow file for this run
This file contains 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: scfeu Build Action | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- .github/workflows/scfeu.yaml | |
- scfeu/** | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- .github/workflows/scfeu.yaml | |
- scfeu/** | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Debug, Release] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Setup Nuget | |
uses: Nuget/setup-nuget@v2 | |
- name: Restore nuget packages | |
run: nuget restore scfeu\scfeu.sln | |
- name: Inject build number | |
shell: pwsh | |
run: | | |
$filePath = ".\scfeu\Properties\AssemblyInfo.cs" | |
$cs = get-content $filePath -Raw | |
$cs -match "(?mi)^\[\s*assembly:\s*AssemblyVersion\(\s*`"([\d\.]+)`"\s*\)\s*\]" | |
$version = New-Object System.Version $matches[1] | |
$version = New-Object System.Version @( $version.Major, $version.Minor, ([System.Math]::Max(0, $version.Build)), 0 ) | |
$cs = $cs -replace "(?mi)(\[\s*assembly:\s*AssemblyVersion\(\s*`")[\d\.]+(`"\s*\)\s*\])","`${1}$version`$2" | |
$version = New-Object System.Version @( $version.Major, $version.Minor, ([System.Math]::Max(0, $version.Build)), $env:GITHUB_RUN_NUMBER ) | |
Write-Host "Version number: $version" | |
$cs = $cs -replace "(?mi)(\[\s*assembly:\s*AssemblyFileVersion\(\s*`")[\d\.]+(`"\s*\)\s*\])","`${1}$version`$2" | |
set-content -Path $filePath -Value $cs | |
Write-Output "FULL_VERSION_NUMBER=$version" >> $env:GITHUB_ENV | |
- name: Build | |
run: msbuild /m /p:Configuration=${{matrix.configuration}} /p:platform="Any CPU" scfeu\scfeu.sln | |
- name: Copy Extra Files | |
if: ${{ matrix.configuration == 'Release' }} | |
shell: pwsh | |
run: | | |
copy .\LICENSE .\scfeu\bin\${{matrix.configuration}}\ | |
.\Scripts\makeProjReadme.ps1 scfeu .\scfeu\bin\${{matrix.configuration}}\README.md | |
- name: Upload Artifacts | |
if: ${{ matrix.configuration == 'Release' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: scfeu-${{env.FULL_VERSION_NUMBER}} | |
path: | | |
scfeu/bin/${{matrix.configuration}} | |
!**/*.pdb | |
!**/scfeu.exe.config | |
if-no-files-found: error |