From 1290f4a359d62e94eb776ec4c2750f17bd4f38b6 Mon Sep 17 00:00:00 2001 From: Othmane Ataallah <”othmane.ataallah.triztech@gmail.com”> Date: Tue, 28 Apr 2026 11:13:46 +0100 Subject: [PATCH] fix ci-cd --- .gitea/workflows/pushMainTo150.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/pushMainTo150.yml b/.gitea/workflows/pushMainTo150.yml index 85de39a..6b6b0b8 100644 --- a/.gitea/workflows/pushMainTo150.yml +++ b/.gitea/workflows/pushMainTo150.yml @@ -15,11 +15,13 @@ jobs: # === WORKSPACE === WORKSPACE_DIR: C:\CICD\workspace\triz-docs DEPLOY_DIR: C:\inetpub\wwwroot\docs + # === NODE — adjust this path if your Node.js is installed elsewhere === + NODE_PATH: C:\Program Files\nodejs steps: # -------------------------------------------------- - # 1. Clean slate — wipe any leftover from a previous run + # 1. Clean slate # -------------------------------------------------- - name: Prepare workspace shell: cmd @@ -29,8 +31,9 @@ jobs: if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% # -------------------------------------------------- - # 2. Shallow clone — token scoped to this step only - # to limit its exposure in the environment + # 2. Shallow clone + # -c credential.helper= disables Git Credential Manager + # entirely for this command — credentials come from the URL only # -------------------------------------------------- - name: Clone source code if: success() @@ -38,17 +41,22 @@ jobs: env: GIT_TOKEN: ${{ secrets.GITEAACTTOKEN }} run: | - git clone --depth 1 --branch %BRANCH% http://ciRunner:%GIT_TOKEN%@%GIT_REPO_URL% "%WORKSPACE_DIR%" + git -c credential.helper= clone --depth 1 --branch %BRANCH% http://ciRunner:%GIT_TOKEN%@%GIT_REPO_URL% "%WORKSPACE_DIR%" if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% # -------------------------------------------------- - # 3. Install exact dependency tree from lock file + # 3. Install dependencies + # PATH is extended here so npm is always found + # regardless of how the runner account was set up # -------------------------------------------------- - name: Install dependencies if: success() shell: cmd run: | + set PATH=%NODE_PATH%;%PATH% cd /d "%WORKSPACE_DIR%" + node --version + npm --version npm ci if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% @@ -59,13 +67,15 @@ jobs: if: success() shell: cmd run: | + set PATH=%NODE_PATH%;%PATH% cd /d "%WORKSPACE_DIR%" npm run build if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% # -------------------------------------------------- - # 5. Deploy — robocopy exit codes 0-7 are all success - # (bitmask of what changed: copied, skipped, etc.) + # 5. Deploy + # /E = include subdirectories (even empty ones) + # /PURGE = remove destination files absent from source # -------------------------------------------------- - name: Deploy if: success() @@ -76,7 +86,7 @@ jobs: if %ERRORLEVEL% gtr 7 exit /b %ERRORLEVEL% # -------------------------------------------------- - # 6. Always clean up — no source code left on the runner + # 6. Always clean up # -------------------------------------------------- - name: Cleanup workspace if: always()