Merge branch 'more-ci' #2
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: TestConApp Build Action | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- .github/workflows/TestConApp.yaml | |
- TestConApp/** | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- .github/workflows/TestConApp.yaml | |
- TestConApp/** | |
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: Install .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Install dependencies | |
run: dotnet restore ./TestConApp/TestConApp.sln | |
- name: Inject build number | |
shell: pwsh | |
run: | | |
$csproj = New-Object System.XML.XMLDocument | |
$csprojPath = Resolve-Path "./TestConApp/TestConApp.csproj" | |
$csproj.Load($csprojPath) | |
$version = New-Object System.Version $csproj.Project.PropertyGroup.Version | |
$version = New-Object System.Version @( $version.Major, $version.Minor, ([System.Math]::Max(0, $version.Build)), $env:GITHUB_RUN_NUMBER ) | |
Write-Host "Version number: $version" | |
$csproj.Project.PropertyGroup.Version = $version.ToString() | |
$csproj.Save($csprojPath) | |
Write-Output "FULL_VERSION_NUMBER=$version" >> $env:GITHUB_ENV | |
- name: Build | |
run: dotnet build --configuration ${{ matrix.configuration }} --no-restore ./TestConApp/TestConApp.csproj | |
- name: Publish | |
if: ${{ matrix.configuration == 'Release' }} | |
run: dotnet publish --configuration Release -p:PublishProfile=FolderProfile -p:DebugType=None -p:DebugSymbols=false --no-build --no-restore ./TestConApp/TestConApp.csproj | |
- name: Copy Extra Files | |
if: ${{ matrix.configuration == 'Release' }} | |
shell: pwsh | |
run: | | |
copy .\LICENSE .\TestConApp\bin\Publish\ | |
.\Scripts\makeProjReadme.ps1 TestConApp .\TestConApp\bin\Publish\README.md | |
- name: Upload Artifacts | |
if: ${{ matrix.configuration == 'Release' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: TestConApp-${{env.FULL_VERSION_NUMBER}} | |
path: | | |
TestConApp/bin/publish | |
!**/*.pdb | |
if-no-files-found: error |