Skip to content

Commit

Permalink
Build action for LoginWhen
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrottel committed Feb 17, 2024
1 parent afc2fe6 commit 2337483
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/LoginWhen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: LoginWhen Build Action

on:
push:
branches: [ "main", "loginwhen/action" ]
paths:
- .github\workflows\LoginWhen.yaml
- LoginWhen\**
pull_request:
branches: [ "main", "loginwhen/action" ]
paths:
- .github\workflows\LoginWhen.yaml
- LoginWhen\**
workflow_dispatch:

jobs:
build:
strategy:
matrix:
configuration: [Debug, Release]
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Install dependencies
run: dotnet restore .\LoginWhen\LoginWhen.sln

- name: Inject build number
shell: pwsh
run: |
$csproj = New-Object System.XML.XMLDocument
$csprojPath = Resolve-Path ".\LoginWhen\LoginWhen.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 .\LoginWhen\LoginWhen.sln

- name: Publish
if: ${{ matrix.configuration == 'Release' }}
run: dotnet publish -c Release -p:PublishProfile=FolderProfile -p:DebugType=None -p:DebugSymbols=false --no-build --no-restore .\LoginWhen\LoginWhen.sln

- name: Upload Artifacts
if: ${{ matrix.configuration == 'Release' }}
uses: actions/upload-artifact@v3
with:
name: LoginWhen-${{env.FULL_VERSION_NUMBER}}
path: |
LoginWhen\bin\Publish
if-no-files-found: error

0 comments on commit 2337483

Please sign in to comment.