1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
-
6
- # This workflow will build, test, sign and package a WPF or Windows Forms desktop application
7
- # built on .NET Core.
8
- # To learn how to migrate your existing application to .NET Core,
9
- # refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
10
- #
11
- # To configure this workflow:
12
- #
13
- # 1. Configure environment variables
14
- # GitHub sets default environment variables for every workflow run.
15
- # Replace the variables relative to your project in the "env" section below.
16
- #
17
- # 2. Signing
18
- # Generate a signing certificate in the Windows Application
19
- # Packaging Project or add an existing signing certificate to the project.
20
- # Next, use PowerShell to encode the .pfx file using Base64 encoding
21
- # by running the following Powershell script to generate the output string:
22
- #
23
- # $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
24
- # [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
25
- #
26
- # Open the output file, SigningCertificate_Encoded.txt, and copy the
27
- # string inside. Then, add the string to the repo as a GitHub secret
28
- # and name it "Base64_Encoded_Pfx."
29
- # For more information on how to configure your signing certificate for
30
- # this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
31
- #
32
- # Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
33
- # See "Build the Windows Application Packaging project" below to see how the secret is used.
34
- #
35
- # For more information on GitHub Actions, refer to https://github.com/features/actions
36
- # For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
37
- # refer to https://github.com/microsoft/github-actions-for-desktop-apps
38
-
39
- name : .NET Core Desktop
1
+ name : Release Build
40
2
41
3
on :
42
4
push :
43
5
branches : [ "main" ]
44
- # pull_request:
45
- # branches: [ "main" ]
46
-
47
- env :
48
- APP_NAME : SQLServerCoverage
49
- APP_VERSION : 2.2
50
- DOTNET_VERSION : ' 7.0.x'
6
+ paths :
7
+ - ' src/**'
8
+ - ' .github/workflows/**'
51
9
52
10
permissions :
53
11
contents : write
54
12
55
13
jobs :
14
+ prepare :
15
+ runs-on : ubuntu-latest
16
+ outputs :
17
+ version : ${{ steps.get_version.outputs.version }}
18
+ steps :
19
+ - uses : actions/checkout@v4
20
+
21
+ # Extract version from csproj
22
+ - name : Get Version
23
+ id : get_version
24
+ shell : pwsh
25
+ run : |
26
+ $xml = [xml](Get-Content ./src/SQLServerCoverageCore/SQLServerCoverageCore.csproj)
27
+ $version = $xml.Project.PropertyGroup.Version
28
+ echo "version=$version" >> $env:GITHUB_OUTPUT
29
+ echo "Extracted version: $version"
30
+
56
31
build :
32
+ needs : prepare
57
33
runs-on : windows-latest
58
34
strategy :
59
35
matrix :
36
+ # Define target platforms
60
37
os : [win10-x64, ubuntu.20.04-x64, linux-x64, osx-x64]
61
38
62
- # Build Steps
39
+ env :
40
+ APP_NAME : SQLServerCoverage
41
+ APP_VERSION : ${{ needs.prepare.outputs.version }}
42
+ DOTNET_VERSION : ' 8.0.x'
43
+
63
44
steps :
64
- - name : Checkout
65
- uses : actions/checkout@v3
45
+ - name : Checkout Repository
46
+ uses : actions/checkout@v4
66
47
67
- # Refer : https://github.com/actions/setup-dotnet/blob/main/action.yml
68
48
- name : Setup .NET
69
- uses : actions/setup-dotnet@v3
49
+ uses : actions/setup-dotnet@v4
70
50
with :
71
51
dotnet-version : ${{ env.DOTNET_VERSION }}
72
52
73
- - name : ' Show dotnet info'
74
- run : dotnet --info
75
-
76
- - name : Build and publish app for multiple platform
77
- run : >
78
- dotnet publish src/SQLServerCoverageCore/SQLServerCoverageCore.csproj
79
- -c Release -r ${{ matrix.os }} -o "releases/${{ matrix.os }}/${{env.APP_NAME}}"
80
- --sc true
53
+ # Build and publish for each platform
54
+ - name : Build and Publish
55
+ run : |
56
+ dotnet publish src/SQLServerCoverageCore/SQLServerCoverageCore.csproj `
57
+ -c Release `
58
+ -r ${{ matrix.os }} `
59
+ -o "releases/${{ matrix.os }}/${{env.APP_NAME}}" `
60
+ --sc true `
61
+ -p:Version=${{ env.APP_VERSION }}
81
62
82
- - name : ' Zipping ${{env.APP_NAME}}_${{ env.APP_VERSION }} for release'
83
- run : >
84
- echo "current path $pwd" &&
85
- New-Item -ItemType Directory -Force -Path ./releases/packages &&
86
- Compress-Archive -Path "./releases/${{ matrix.os }}/${{env.APP_NAME}}/*" -DestinationPath "./releases/packages/${{env.APP_NAME}}_${{ env.APP_VERSION }}_${{ matrix.os }}.zip"
63
+ # Create release packages
64
+ - name : Create Release Package
65
+ run : |
66
+ New-Item -ItemType Directory -Force -Path ./releases/packages
67
+ Compress-Archive `
68
+ -Path "./releases/${{ matrix.os }}/${{env.APP_NAME}}/*" `
69
+ -DestinationPath "./releases/packages/${{env.APP_NAME}}_${{ env.APP_VERSION }}_${{ matrix.os }}.zip"
87
70
88
-
89
- - name : Releasing github package for ${{ matrix.os }}
90
- uses : softprops/action-gh-release@v1
71
+ # Create GitHub release and upload artifacts
72
+ - name : Create GitHub Release
73
+ uses : softprops/action-gh-release@v2
91
74
with :
92
- name : SQLServerCoverage V${{ env.APP_VERSION }}
93
- body : Releasing ${{env.APP_NAME}}_${{ env.APP_VERSION }}
75
+ name : SQLServerCoverage v${{ env.APP_VERSION }}
76
+ body : |
77
+ SQLServerCoverage Version ${{ env.APP_VERSION }}
78
+
79
+ ## Platform Specific Builds
80
+ - Windows (win10-x64)
81
+ - Ubuntu 20.04 (ubuntu.20.04-x64)
82
+ - Linux (linux-x64)
83
+ - macOS (osx-x64)
84
+
85
+ Please check the release notes for detailed changes.
94
86
tag_name : v${{ env.APP_VERSION }}
95
- files : ./releases/packages/${{env.APP_NAME}}_${{ env.APP_VERSION }}_${{ matrix.os }}.zip
96
- token : ${{ secrets.GITHUB_TOKEN }}
87
+ files : ./releases/packages/${{env.APP_NAME}}_${{ env.APP_VERSION }}_${{ matrix.os }}.zip
88
+ token : ${{ secrets.GITHUB_TOKEN }}
97
89
generate_release_notes : true
90
+ draft : false
91
+ prerelease : false
92
+
93
+
0 commit comments