Skip to content

Commit 7e57ba2

Browse files
committed
Fix CI manual tag versioning to use tag creation date
- Tag builds: Extract date from tag creation date using git for-each-ref (fixes issue where tag release/weekly/251027 created 10/27 produced packages dated 251021 from commit date) - Non-tag builds: Omit VERSION_DATE parameter, allowing script to default to current date (Get-Date -UFormat %y%m%d) - Conditionally pass -DateForVersion parameter only when VERSION_DATE is set Root cause: Original code used 'git log -1 --format=%cd' without tag reference, extracting commit date instead of tag creation date for all build scenarios.
1 parent d98ebeb commit 7e57ba2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,12 @@ jobs:
287287
fetch-depth: 0
288288
fetch-tags: true
289289

290-
- name: Format Date/Time of Commit for Package Version
290+
- name: Format Date/Time for Package Version (Tag builds only)
291+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
291292
run: |
292-
echo "VERSION_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)" >> $env:GITHUB_ENV
293+
# Tag builds: use tag creation date (allows manual tags with specific dates)
294+
# Non-tag builds: VERSION_DATE not set, script defaults to current date if needed
295+
echo "VERSION_DATE=$(git for-each-ref --format='%(creatordate:format:%y%m%d)' ${{ github.ref }})" >> $env:GITHUB_ENV
293296
294297
- name: Restore dotnet tools
295298
run: dotnet tool restore
@@ -330,7 +333,7 @@ jobs:
330333
# Build and pack component nupkg
331334
- name: Build and pack component packages
332335
if: ${{ env.HAS_BUILDABLE_COMPONENTS == 'true' }}
333-
run: ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -Components ${{ env.CHANGED_COMPONENTS_LIST }} -WinUIMajorVersion ${{ matrix.winui }} -DateForVersion ${{ env.VERSION_DATE }} ${{ env.VERSION_PROPERTY != '' && format('-PreviewVersion "{0}"', env.VERSION_PROPERTY) || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-EnableBinlogs' || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-Verbose' || '' }} -BinlogOutput ./ -NupkgOutput ./ -Release
336+
run: ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -Components ${{ env.CHANGED_COMPONENTS_LIST }} -WinUIMajorVersion ${{ matrix.winui }} ${{ env.VERSION_DATE != '' && format('-DateForVersion {0}', env.VERSION_DATE) || '' }} ${{ env.VERSION_PROPERTY != '' && format('-PreviewVersion "{0}"', env.VERSION_PROPERTY) || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-EnableBinlogs' || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-Verbose' || '' }} -BinlogOutput ./ -NupkgOutput ./ -Release
334337

335338
- name: Validate package names
336339
if: ${{ env.VERSION_PROPERTY != '' && env.HAS_BUILDABLE_COMPONENTS == 'true' }}

0 commit comments

Comments
 (0)