-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (49 loc) · 2.6 KB
/
github-actions-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Release
on:
workflow_dispatch:
inputs:
VersionPrefix:
type: string
description: The version of the library
required: true
default: 0.9.0
VersionSuffix:
type: string
description: The version suffix of the library (for example rc.1)
run-name: ${{ inputs.VersionPrefix }}${{ inputs.VersionSuffix && '-' || '' }}${{ inputs.VersionSuffix }}
jobs:
build:
env:
SETUP_PROJECT_FILE: "./src/Pdf.PasswordRemover.WinForms.Setup/Pdf.PasswordRemover.WinForms.Setup.vdproj"
VERSION: ${{ inputs.VersionPrefix }}${{ inputs.VersionSuffix && '-' || '' }}${{ inputs.VersionSuffix }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8.x SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Build executable application
run: dotnet build --property:Configuration=Release --property:AssemblyVersion=${{ inputs.VersionPrefix }} --property:FileVersion=${{ inputs.VersionPrefix }} --property:InformationalVersion=${{ env.VERSION }} "./src/Pdf.PasswordRemover.WinForms/Pdf.PasswordRemover.WinForms.csproj"
- name: Setup Visual Studio environment
uses: seanmiddleditch/gha-setup-vsdevenv@v4
- name: Update the .vdproj file
shell: pwsh
run: |
$newProductCode = [System.Guid]::NewGuid().ToString("B").ToUpper()
$content = Get-Content -Path $env:SETUP_PROJECT_FILE -Raw
$content = $content -replace '"ProductVersion" = "8:.*?"', '"ProductVersion" = "8:${{ inputs.VersionPrefix }}"'
$content = $content -replace '"OutputFilename" = "8:Release\\\\PdfPasswordRemover.msi"', '"OutputFilename" = "8:Release\\PdfPasswordRemover_${{ env.VERSION }}.msi"'
$content = $content -replace '"ProductCode" = "8:{CB215E38-E864-48E0-851B-6B2B67958B42}"', ('"ProductCode" = "8:' + $newProductCode + '"')
Set-Content -Path $env:SETUP_PROJECT_FILE -Value $content
Write-Host "Version updated to '${{ inputs.VersionPrefix }}' in '$env:SETUP_PROJECT_FILE'"
Write-Host "OutputFilename property updated to 'Release\\PdfPasswordRemover_${{ env.VERSION }}.msi' in '$env:SETUP_PROJECT_FILE'"
Write-Host "ProductCode property updated to '$newProductCode' in '$env:SETUP_PROJECT_FILE'"
- name: Build MSI package
run: devenv "${{ env.SETUP_PROJECT_FILE }}" /Build "Release"
- name: Upload MSI package
uses: actions/upload-artifact@v4
with:
name: installer
path: |
./src/Pdf.PasswordRemover.WinForms.Setup/Release/