ci(release): avoid powershell policy by using cmd node bootstrap
All checks were successful
Desktop CI / tests (push) Successful in 13s
All checks were successful
Desktop CI / tests (push) Successful in 13s
This commit is contained in:
@@ -11,24 +11,29 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Ensure Node.js for Gitea actions
|
||||
shell: powershell
|
||||
shell: cmd
|
||||
run: |
|
||||
if (Get-Command node -ErrorAction SilentlyContinue) {
|
||||
where node
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
node --version
|
||||
exit 0
|
||||
}
|
||||
$nodeVersion = "v20.19.0"
|
||||
$zipUrl = "https://nodejs.org/dist/$nodeVersion/node-$nodeVersion-win-x64.zip"
|
||||
$zipPath = "$env:RUNNER_TEMP\node.zip"
|
||||
$extractRoot = "$env:RUNNER_TEMP\node"
|
||||
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath
|
||||
Expand-Archive -Path $zipPath -DestinationPath $extractRoot -Force
|
||||
$nodeDir = Get-ChildItem -Path $extractRoot -Directory | Select-Object -First 1
|
||||
if (-not $nodeDir) {
|
||||
throw "Node.js archive extracted incorrectly."
|
||||
}
|
||||
$nodeDir.FullName | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
$env:PATH = "$($nodeDir.FullName);$env:PATH"
|
||||
exit /b 0
|
||||
)
|
||||
set "NODE_VERSION=v20.19.0"
|
||||
set "ZIP_URL=https://nodejs.org/dist/%NODE_VERSION%/node-%NODE_VERSION%-win-x64.zip"
|
||||
set "ZIP_PATH=%RUNNER_TEMP%\node.zip"
|
||||
set "EXTRACT_ROOT=%RUNNER_TEMP%\node"
|
||||
mkdir "%EXTRACT_ROOT%"
|
||||
curl.exe -fsSL "%ZIP_URL%" -o "%ZIP_PATH%"
|
||||
tar -xf "%ZIP_PATH%" -C "%EXTRACT_ROOT%"
|
||||
for /d %%D in ("%EXTRACT_ROOT%\*") do (
|
||||
set "NODE_DIR=%%~fD"
|
||||
goto :node_found
|
||||
)
|
||||
echo Node.js archive extracted incorrectly.
|
||||
exit /b 1
|
||||
:node_found
|
||||
echo %NODE_DIR%>>"%GITHUB_PATH%"
|
||||
set "PATH=%NODE_DIR%;%PATH%"
|
||||
node --version
|
||||
|
||||
- name: Checkout
|
||||
|
||||
Reference in New Issue
Block a user