diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26ab09b..d16b29a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: Build (Windows) on: push: - branches: [ "master", "main", "sow/2026-Q2" ] + branches: [ "master", "main", "sow/**" ] pull_request: - branches: [ "master", "main", "sow/2026-Q2" ] + branches: [ "master", "main", "sow/**" ] workflow_dispatch: jobs: @@ -35,6 +35,36 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 + - name: Compute SAMVersion + id: ver + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + # Prefer head_ref when its a sow branch (release-promotion PRs from sow/* to main), + # else use base_ref on PR events / ref_name on push events. + $headRef = '${{ github.head_ref }}' + $baseRef = '${{ github.base_ref }}' + $refName = '${{ github.ref_name }}' + if ($headRef -match '^sow/\d{4}-Q\d$') { + $ref = $headRef + } elseif ('${{ github.event_name }}' -eq 'pull_request') { + $ref = $baseRef + } else { + $ref = $refName + } + # .NET AssemblyVersion components are UInt16 (max 65535). Cap to 60000 for headroom. + $run = ${{ github.run_number }} % 60000 + if ($ref -match 'sow/(\d{4})-Q(\d)') { + $v = "$($Matches[1]).$($Matches[2]).$run.0" + $src = "branch '$ref'" + } else { + $now = (Get-Date).ToUniversalTime() + $quarter = [int][Math]::Ceiling($now.Month / 3.0) + $v = "$($now.Year).$quarter.$run.0" + $src = "date $($now.ToString('yyyy-MM-dd')) (ref '$ref' not sow/yyyy-Qx)" + } + Write-Host "SAMVersion = $v (from $src)" + "samversion=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - name: Clone dependency repos (siblings) shell: pwsh @@ -56,8 +86,13 @@ jobs: foreach ($r in $deps) { if (Test-Path $r) { continue } $headRef = '${{ github.head_ref }}' + $baseRef = '${{ github.base_ref }}' + $refName = '${{ github.ref_name }}' $candidates = @() if ($headRef) { $candidates += $headRef } + # Current sow branch: base_ref on PR events, ref_name on push events. + $sowRef = if ($baseRef -match '^sow/') { $baseRef } elseif ($refName -match '^sow/') { $refName } else { '' } + if ($sowRef -and $sowRef -ne $headRef) { $candidates += $sowRef } $candidates += 'sow/2026-Q2' $cloned = $false foreach ($cand in $candidates) { @@ -94,6 +129,7 @@ jobs: '/v:m' '/p:Configuration=Release' '/p:UseSharedCompilation=false' + '/p:SAMVersion=${{ steps.ver.outputs.samversion }}' '/p:RunPostBuildEvent=OnOutputUpdated' "/p:ReferencePath=$windowsRef" ) diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..9841655 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,39 @@ + + + + + 1.0.0.0 + $(SAMVersion) + $(SAMVersion) + true + + + + + + <_SAMVersionLine Include="// <auto-generated />" /> + <_SAMVersionLine Include="[assembly: System.Reflection.AssemblyVersionAttribute("$(SAMVersion)")]" /> + <_SAMVersionLine Include="[assembly: System.Reflection.AssemblyFileVersionAttribute("$(SAMVersion)")]" /> + + + + + + + + + + diff --git a/Grasshopper/SAM.Analytical.Grasshopper.TMP/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Analytical.Grasshopper.TMP/Kernel/AssemblyInfo.cs index 4d59577..177e4f8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper.TMP/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper.TMP/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; diff --git a/Grasshopper/SAM.Analytical.Grasshopper.TMP/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Analytical.Grasshopper.TMP/Properties/AssemblyInfo.cs index cd4373a..6fc7b87 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper.TMP/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper.TMP/Properties/AssemblyInfo.cs @@ -55,6 +55,3 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Grasshopper/SAM.Analytical.Grasshopper.TMP/SAM.Analytical.Grasshopper.TMP.csproj b/Grasshopper/SAM.Analytical.Grasshopper.TMP/SAM.Analytical.Grasshopper.TMP.csproj index 87b8b9f..98cf142 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper.TMP/SAM.Analytical.Grasshopper.TMP.csproj +++ b/Grasshopper/SAM.Analytical.Grasshopper.TMP/SAM.Analytical.Grasshopper.TMP.csproj @@ -10,7 +10,6 @@ false true true - false false false diff --git a/Grasshopper/SAM.Core.Grasshopper.TMP/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Core.Grasshopper.TMP/Kernel/AssemblyInfo.cs index d64e096..5cf95ac 100644 --- a/Grasshopper/SAM.Core.Grasshopper.TMP/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Core.Grasshopper.TMP/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; diff --git a/Grasshopper/SAM.Core.Grasshopper.TMP/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Core.Grasshopper.TMP/Properties/AssemblyInfo.cs index 0c0032f..874d4fa 100644 --- a/Grasshopper/SAM.Core.Grasshopper.TMP/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Core.Grasshopper.TMP/Properties/AssemblyInfo.cs @@ -55,6 +55,3 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Grasshopper/SAM.Core.Grasshopper.TMP/SAM.Core.Grasshopper.TMP.csproj b/Grasshopper/SAM.Core.Grasshopper.TMP/SAM.Core.Grasshopper.TMP.csproj index 13098db..715d271 100644 --- a/Grasshopper/SAM.Core.Grasshopper.TMP/SAM.Core.Grasshopper.TMP.csproj +++ b/Grasshopper/SAM.Core.Grasshopper.TMP/SAM.Core.Grasshopper.TMP.csproj @@ -11,7 +11,6 @@ true true C:\Program Files\Rhino 8\System\Rhino.exe - false false false True diff --git a/SAM_TMP/SAM.Analytical.TMP/Properties/AssemblyInfo.cs b/SAM_TMP/SAM.Analytical.TMP/Properties/AssemblyInfo.cs index e46b4e2..fc1a18b 100644 --- a/SAM_TMP/SAM.Analytical.TMP/Properties/AssemblyInfo.cs +++ b/SAM_TMP/SAM.Analytical.TMP/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/SAM_TMP/SAM.Analytical.TMP/SAM.Analytical.TMP.csproj b/SAM_TMP/SAM.Analytical.TMP/SAM.Analytical.TMP.csproj index 8720753..7de9420 100644 --- a/SAM_TMP/SAM.Analytical.TMP/SAM.Analytical.TMP.csproj +++ b/SAM_TMP/SAM.Analytical.TMP/SAM.Analytical.TMP.csproj @@ -2,13 +2,10 @@ netstandard2.0 Library - false false SAM.Analytical SAM.Analytical Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors - 1.0.0.0 - 1.0.0.0 false false diff --git a/SAM_TMP/SAM.Core.TMP/Properties/AssemblyInfo.cs b/SAM_TMP/SAM.Core.TMP/Properties/AssemblyInfo.cs index cf1e05d..2fa9aca 100644 --- a/SAM_TMP/SAM.Core.TMP/Properties/AssemblyInfo.cs +++ b/SAM_TMP/SAM.Core.TMP/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/SAM_TMP/SAM.Core.TMP/SAM.Core.TMP.csproj b/SAM_TMP/SAM.Core.TMP/SAM.Core.TMP.csproj index 7f5935b..53fa88d 100644 --- a/SAM_TMP/SAM.Core.TMP/SAM.Core.TMP.csproj +++ b/SAM_TMP/SAM.Core.TMP/SAM.Core.TMP.csproj @@ -2,13 +2,10 @@ netstandard2.0 Library - false false SAM SAM Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors - 1.0.0.0 - 1.0.0.0 false false diff --git a/SAM_TMP/SAM.Geometry.TMP/Properties/AssemblyInfo.cs b/SAM_TMP/SAM.Geometry.TMP/Properties/AssemblyInfo.cs index cf1e05d..2fa9aca 100644 --- a/SAM_TMP/SAM.Geometry.TMP/Properties/AssemblyInfo.cs +++ b/SAM_TMP/SAM.Geometry.TMP/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/SAM_TMP/SAM.Geometry.TMP/SAM.Geometry.TMP.csproj b/SAM_TMP/SAM.Geometry.TMP/SAM.Geometry.TMP.csproj index 924393f..de3eb0f 100644 --- a/SAM_TMP/SAM.Geometry.TMP/SAM.Geometry.TMP.csproj +++ b/SAM_TMP/SAM.Geometry.TMP/SAM.Geometry.TMP.csproj @@ -2,13 +2,10 @@ netstandard2.0 Library - false false SAM SAM Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors - 1.0.0.0 - 1.0.0.0 false false