From 588a7b07901944a81fb03b243b6301fd0c769f67 Mon Sep 17 00:00:00 2001 From: Aabishkar KC Date: Wed, 12 Jun 2024 13:07:15 -0400 Subject: [PATCH] DYN-7070 Merge check file version workflow into build workflow (#15308) --- .github/scripts/check_file_version.ps1 | 18 ++++++++++---- .github/workflows/build_dynamo_all.yml | 4 +++- .github/workflows/check_file_version.yml | 30 ------------------------ 3 files changed, 16 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/check_file_version.yml diff --git a/.github/scripts/check_file_version.ps1 b/.github/scripts/check_file_version.ps1 index 9475b2891c2..c0330adf076 100644 --- a/.github/scripts/check_file_version.ps1 +++ b/.github/scripts/check_file_version.ps1 @@ -76,13 +76,13 @@ if (Test-Path $dynamoSandbox) { $fileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dynamoSandbox).FileVersion try { $dynamoVersion = [System.Version]::Parse($fileVersion) - Write-Host "ℹ️ DynamoSandbox.exe - $dynamoVersion`n" + Write-Output "::notice::ℹ️ DynamoSandbox.exe - $dynamoVersion`n" } catch { - Write-Host "❌ Failed to get the version of DynamoSandbox.exe" + Write-Output "::error::❌ Failed to get the version of DynamoSandbox.exe" exit 1 } } else { - Write-Host "⚠️ DynamoSandbox.exe was not found" + Write-Output "::error::⚠️ DynamoSandbox.exe was not found" exit 1 } @@ -107,12 +107,20 @@ foreach ($file in $files) { if ($noVersion.Count -gt 0 -Or $wrongVersion.Count -gt 0) { if ($noVersion.Count -gt 0) { Write-Host "`n`e[4mThe following file(s) don't have version information`e[24m" - $noVersion | ForEach-Object { Write-Host ❌ $_.Name - $_.FullName } + $title = "Missing version information" + foreach ($file in $noVersion) { + $message = "$($file.Name) - $($file.FullName)" + Write-Output "::error title=$title::$message" + } } if ($wrongVersion.Count -gt 0) { Write-Host "`n`e[4mThe following file(s) don't have the expected version: $dynamoVersion`e[24m" - $wrongVersion | ForEach-Object { Write-Host ❌ $_.Name - $_.FullName - (Get-Item $_).VersionInfo.FileVersion } + $title = "Unexpected version information" + foreach ($file in $wrongVersion) { + $message = "$($file.Name) - $($file.FullName) - $($(Get-Item $file).VersionInfo.FileVersion)" + Write-Output "::error title=$title::$message" + } } exit 1 } diff --git a/.github/workflows/build_dynamo_all.yml b/.github/workflows/build_dynamo_all.yml index 3100215e2fe..685ff5e618a 100644 --- a/.github/workflows/build_dynamo_all.yml +++ b/.github/workflows/build_dynamo_all.yml @@ -37,8 +37,10 @@ jobs: if (Test-Path -Path "${{ github.workspace }}\Dynamo\bin\AnyCPU\Release\DynamoCLI.exe") { Write-Output "DynamoCLI.exe exists!" } else { - Write-Error "DynamoCLI.exe was not found!" + Write-Output "::error title=File Not Found::DynamoCLI.exe was not found!" } + - name: Check File Version + run: ${{ github.workspace }}\Dynamo\.github\scripts\check_file_version.ps1 ${{ github.workspace }}\Dynamo\bin\AnyCPU\Release - name: Upload Build Artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/check_file_version.yml b/.github/workflows/check_file_version.yml deleted file mode 100644 index 0664c75a4cb..00000000000 --- a/.github/workflows/check_file_version.yml +++ /dev/null @@ -1,30 +0,0 @@ -# Runs on completion of "Build DynamoAll.sln net8.0" workflow -# -# - Checks file version of exes and dlls -# - Fails if any file is missing version information -# - Fails if any Dynamo related files have incorrect version information -name: Check file version - -on: - workflow_run: - workflows: - - Build DynamoAll.sln net8.0 - types: - - completed - -jobs: - check_file_version: - name: Check file version - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - - name: Download build artifact - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 - with: - github-token: ${{ secrets.DYNAMO_ACTIONS_TOKEN }} - run-id: ${{ github.event.workflow_run.id }} - name: DynamoSandbox - path: build - - name: Check file version - run: ${{ github.workspace }}\.github\scripts\check_file_version.ps1 ${{ github.workspace }}\build