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