From 15092b16d6db65bff4b7a02b2627aee9244b6c92 Mon Sep 17 00:00:00 2001 From: dijunkun Date: Fri, 30 Oct 2026 16:39:12 +0800 Subject: [PATCH] [fix] remove deprecated Node.js 20 actions from CLI builds --- .github/workflows/build-cli.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 72f325c9..14913d9a 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -34,12 +34,13 @@ jobs: env: XMAKE_VERSION: "3.1.1" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: recursive - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v6 with: node-version: 22 + package-manager-cache: false # A runner label can receive compiler/SDK updates without changing its name. - name: Set cache environment id: runner-image @@ -53,10 +54,23 @@ jobs: xmake-version: ${{ env.XMAKE_VERSION }} actions-cache-folder: ${{ runner.temp }}/crossdesk-cli-xmake-toolchain actions-cache-key: cli-${{ matrix.runner }}-${{ matrix.target }}-image${{ steps.runner-image.outputs.version }}-xmake${{ env.XMAKE_VERSION }} - - uses: ilammy/msvc-dev-cmd@v1 + - name: Configure MSVC (x64) if: runner.os == 'Windows' - with: - arch: ${{ matrix.arch }} + shell: pwsh + run: | + $vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe' + $vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath + if ($LASTEXITCODE -ne 0 -or -not $vsPath) { + throw 'Visual Studio C++ build tools were not found' + } + $previousEnv = @{} + Get-ChildItem Env: | ForEach-Object { $previousEnv[$_.Name] = $_.Value } + & (Join-Path $vsPath 'Common7\Tools\Launch-VsDevShell.ps1') -Arch amd64 -HostArch amd64 -SkipAutomaticLocation + Get-Command cl.exe -ErrorAction Stop | Out-Null + # Persist the compiler, SDK and PATH settings for subsequent steps. + Get-ChildItem Env: | Where-Object { $previousEnv[$_.Name] -cne $_.Value } | ForEach-Object { + "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } - name: Linux build tools if: runner.os == 'Linux' shell: bash @@ -107,7 +121,7 @@ jobs: run: xmake run crossdesk-cli doctor --json - name: Package native program and npm entry run: npm --prefix apps/cli run pack:npm - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 with: name: npm-${{ matrix.target }} path: build/npm/*.tgz