fix ci-cd
Some checks failed
Deploy triz-docs to civital server / build-and-deploy (push) Failing after 1h8m5s

This commit is contained in:
Othmane Ataallah 2026-04-28 11:24:20 +01:00
parent 5208d65fa8
commit 7510e3728b

View File

@ -9,13 +9,10 @@ jobs:
runs-on: serveurtest150 runs-on: serveurtest150
env: env:
# === PROJECT ===
GIT_REPO_URL: 145.239.66.197:3000/TrizTech/triz-docs.git GIT_REPO_URL: 145.239.66.197:3000/TrizTech/triz-docs.git
BRANCH: main BRANCH: main
# === WORKSPACE ===
WORKSPACE_DIR: C:\CICD\workspace\triz-docs WORKSPACE_DIR: C:\CICD\workspace\triz-docs
DEPLOY_DIR: C:\inetpub\wwwroot\docs DEPLOY_DIR: C:\inetpub\wwwroot\docs
# === NODE — adjust this path if your Node.js is installed elsewhere ===
NODE_PATH: C:\Program Files\nodejs NODE_PATH: C:\Program Files\nodejs
steps: steps:
@ -31,9 +28,7 @@ jobs:
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
# -------------------------------------------------- # --------------------------------------------------
# 2. Shallow clone # 2. Shallow clone — credential helper disabled
# -c credential.helper= disables Git Credential Manager
# entirely for this command — credentials come from the URL only
# -------------------------------------------------- # --------------------------------------------------
- name: Clone source code - name: Clone source code
if: success() if: success()
@ -46,6 +41,9 @@ jobs:
# -------------------------------------------------- # --------------------------------------------------
# 3. Install dependencies # 3. Install dependencies
# Force-remove any node_modules committed to the repo
# before installing — they would be Linux binaries
# that don't work on Windows
# -------------------------------------------------- # --------------------------------------------------
- name: Install dependencies - name: Install dependencies
if: success() if: success()
@ -53,29 +51,40 @@ jobs:
run: | run: |
set PATH=%NODE_PATH%;%PATH% set PATH=%NODE_PATH%;%PATH%
cd /d "%WORKSPACE_DIR%" cd /d "%WORKSPACE_DIR%"
echo [diag] Node and npm versions:
node --version node --version
npm --version npm --version
npm ci --loglevel warn echo [diag] Removing any committed node_modules...
if exist "node_modules" rmdir /S /Q "node_modules"
echo [diag] Running npm ci...
npm ci
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
echo [diag] Verifying docusaurus binary exists:
if not exist "node_modules\.bin\docusaurus.cmd" (
echo ERROR: docusaurus.cmd not found in node_modules\.bin
exit /b 1
)
echo [diag] Install complete.
# -------------------------------------------------- # --------------------------------------------------
# 4. Build Docusaurus static site # 4. Build
# node_modules\.bin is added explicitly because # Call docusaurus.cmd directly — avoids all PATH
# npm run does not reliably inject it in cmd on Windows # resolution issues with npm run on Windows
# -------------------------------------------------- # --------------------------------------------------
- name: Build - name: Build
if: success() if: success()
shell: cmd shell: cmd
run: | run: |
set PATH=%NODE_PATH%;%NODE_PATH%\node_modules\npm\bin;%WORKSPACE_DIR%\node_modules\.bin;%PATH% set PATH=%NODE_PATH%;%PATH%
cd /d "%WORKSPACE_DIR%" cd /d "%WORKSPACE_DIR%"
npm run build echo [diag] Starting Docusaurus build...
call "%WORKSPACE_DIR%\node_modules\.bin\docusaurus.cmd" build
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
echo [diag] Build complete. Output:
dir /B "%WORKSPACE_DIR%\build"
# -------------------------------------------------- # --------------------------------------------------
# 5. Deploy # 5. Deploy
# /E = include subdirectories (even empty ones)
# /PURGE = remove destination files absent from source
# -------------------------------------------------- # --------------------------------------------------
- name: Deploy - name: Deploy
if: success() if: success()