fix ci-cd
This commit is contained in:
parent
2857bddb08
commit
1290f4a359
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user