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