Skip to content

Commit

Permalink
Update build logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Oct 28, 2024
1 parent ef4e675 commit 9d6de37
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/BuildWin32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ jobs:
with:
dotnet-version: '9.x'

# Step 3: Get version from the project file
- name: Get version from the project file
uses: kzrnm/get-net-sdk-project-versions-action@v2
# Step 3: Get version from Directory.Build.props using PowerShell
- name: Get version from Directory.Build.props
id: get-version
with:
proj-path: .\src\PicView.Avalonia.Win32\PicView.Avalonia.Win32.csproj

run: pwsh -File "${{ github.workspace }}/Build/Get-VersionInfo.ps1"

# Step 4 (x64): Publish x64 version
- name: Publish x64 version
run: |
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/ReleaseSignWindows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ jobs:
with:
dotnet-version: '9.x'

# Step 3: Get version from the project file
- name: Get version from the project file
uses: kzrnm/get-net-sdk-project-versions-action@v2

# Step 3: Get version from Directory.Build.props using PowerShell
- name: Get version from Directory.Build.props
id: get-version
with:
proj-path: .\src\PicView.Avalonia.Win32\PicView.Avalonia.Win32.csproj
run: pwsh -File "${{ github.workspace }}/Build/Get-VersionInfo.ps1"

# Step 4 (x64): Publish x64 version
- name: Publish x64 version
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/TestSignWindows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

# Step 2: Setup .NET 9 SDK
- name: Setup .NET 9 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'

# Step 3: Get version from Directory.Build.props using PowerShell
- name: Get version from Directory.Build.props
id: get-version
run: pwsh -File "${{ github.workspace }}/Build/Get-VersionInfo.ps1"

# Step 3: Get version from the project file
- name: Get version from the project file
Expand Down
16 changes: 16 additions & 0 deletions Build/Get-VersionInfo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Get-VersionInfo.ps1

# Load Directory.Build.props as an XML
[xml]$xml = Get-Content "$PSScriptRoot/../Directory.Build.props"

# Extract VersionPrefix, VersionSuffix, and FileVersion
$versionPrefix = $xml.Project.PropertyGroup.VersionPrefix
$versionSuffix = $xml.Project.PropertyGroup.VersionSuffix
$fileVersion = $xml.Project.PropertyGroup.FileVersion

# Combine VersionPrefix and VersionSuffix
$fullVersion = "$versionPrefix-$versionSuffix"

# Output the results for GitHub Actions
Write-Output "::set-output name=version::$fullVersion"
Write-Output "::set-output name=file-version::$fileVersion"

0 comments on commit 9d6de37

Please sign in to comment.