Skip to content

Build actions for native mini tools #4

Build actions for native mini tools

Build actions for native mini tools #4

Workflow file for this run

name: HWndToFront Build Action
on:
push:
branches: [ "main" ]
paths:
- .github/workflows/HWndToFront.yaml
- HWndToFront/**
pull_request:
branches: [ "main" ]
paths:
- .github/workflows/HWndToFront.yaml
- HWndToFront/**
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
configuration: [Debug, Release]
platform: [x64, x86]
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: Inject build number
shell: pwsh
working-directory: ./HWndToFront
run: |
$vf = get-content "Version.h" -Raw
$vf -match '\n#define\s+HWND_TO_FRONT_VER_MAJOR\s+(\d+)\s*\n' | Out-Null
$major = $Matches[1]
$vf -match '\n#define\s+HWND_TO_FRONT_VER_MINOR\s+(\d+)\s*\n' | Out-Null
$minor = $Matches[1]
$vf -match '\n#define\s+HWND_TO_FRONT_VER_PATCH\s+(\d+)\s*\n' | Out-Null
$patch = $Matches[1]
$nvf = $vf -replace '(\n#define\s+HWND_TO_FRONT_VER_BUILD\s+)(\d+)(\s*\n)',"`${1}$env:GITHUB_RUN_NUMBER`$3"
set-content "Version.h" $nvf -force -nonewline
$version = New-Object System.Version @( $major, $minor, $patch, $env:GITHUB_RUN_NUMBER )
Write-Host "Version number: $version"
Write-Output "FULL_VERSION_NUMBER=$version" >> $env:GITHUB_ENV
- name: Build
working-directory: .
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{matrix.configuration}} /p:Platform=${{matrix.platform}} HWndToFront\HWndToFront.sln
- name: Copy Extra Files
if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }}
shell: pwsh
run: |
copy .\LICENSE ./HWndToFront/bin/${{matrix.platform}}/${{matrix.configuration}}
.\Scripts\makeProjReadme.ps1 HWndToFront ./HWndToFront/bin/${{matrix.platform}}/${{matrix.configuration}}/README.md
- name: Upload Artifacts
if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }}
uses: actions/upload-artifact@v4
with:
name: HWndToFront-${{env.FULL_VERSION_NUMBER}}
path: |
HWndToFront/bin/${{matrix.platform}}/${{matrix.configuration}}
!**/*.pdb
if-no-files-found: error