Files
2025-08-01 14:56:07 +07:00

74 lines
2.4 KiB
YAML

name: Build
on:
workflow_dispatch:
inputs:
net480:
description: Target .NET 4.8
type: boolean
default: false
debug:
description: Build in debug mode
type: boolean
default: false
workflow_call:
outputs:
artifact-id:
description: Uploaded artifact ID
value: ${{ jobs.build.outputs.artifact-id }}
artifact-name:
description: Uploaded artifact name
value: ${{ jobs.build.outputs.artifact-name }}
jobs:
build:
runs-on: windows-2022
outputs:
artifact-id: ${{ steps.artifact-upload-step.outputs.artifact-id }}
artifact-name: ${{ steps.prepare-output-step.outputs.artifact-name }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Prepare envars
run: |
echo "SHORT_SHA=$("${{ github.sha }}" | cut -c1-8)" >> $env:GITHUB_ENV
echo "APP_VERSION=$((Get-Content -Path "app\Program.cs" | Select-String -Pattern 'AppVersion\s=\s"(.+)"' -AllMatches).Matches.Groups[1].Value)" >> $env:GITHUB_ENV
- name: Target .NET 4.8
if: ${{ inputs.net480 }}
run: |
(Get-Content app\ParsecVDisplay.csproj) -replace "TargetFramework>net472", "TargetFramework>net480" | Out-File app\ParsecVDisplay.csproj
(Get-Content app\App.config) -replace "Version=v4.7.2", "Version=v4.8" | Out-File app\App.config
- name: Setup msbuild
uses: microsoft/setup-msbuild@v2
- name: Build app
run: |
cd app
msbuild ParsecVDisplay.csproj /t:Restore
msbuild ParsecVDisplay.csproj /t:Build /p:Configuration=${{ inputs.debug && 'Debug' || 'Release' }} /p:Platform=AnyCPU
- name: Prepare build output
id: prepare-output-step
run: |
echo "${{ env.APP_VERSION }}+${{ env.SHORT_SHA }}" >> app\bin\version
echo "artifact-name=ParsecVDisplay-v${{ env.APP_VERSION }}-${{ env.SHORT_SHA }}" >> $env:GITHUB_OUTPUT
- name: Upload build output
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: ${{ steps.prepare-output-step.outputs.artifact-name }}
path: |
app/bin/version
app/bin/vdd.cmd
app/bin/ParsecVDisplay.exe
app/bin/ParsecVDisplay.exe.config