fix ci-cd
This commit is contained in:
parent
2857bddb08
commit
1290f4a359
@ -15,11 +15,13 @@ jobs:
|
|||||||
# === WORKSPACE ===
|
# === 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
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 1. Clean slate — wipe any leftover from a previous run
|
# 1. Clean slate
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
- name: Prepare workspace
|
- name: Prepare workspace
|
||||||
shell: cmd
|
shell: cmd
|
||||||
@ -29,8 +31,9 @@ jobs:
|
|||||||
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
|
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 2. Shallow clone — token scoped to this step only
|
# 2. Shallow clone
|
||||||
# to limit its exposure in the environment
|
# -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()
|
||||||
@ -38,17 +41,22 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GIT_TOKEN: ${{ secrets.GITEAACTTOKEN }}
|
GIT_TOKEN: ${{ secrets.GITEAACTTOKEN }}
|
||||||
run: |
|
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%
|
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
|
- name: Install dependencies
|
||||||
if: success()
|
if: success()
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
|
set PATH=%NODE_PATH%;%PATH%
|
||||||
cd /d "%WORKSPACE_DIR%"
|
cd /d "%WORKSPACE_DIR%"
|
||||||
|
node --version
|
||||||
|
npm --version
|
||||||
npm ci
|
npm ci
|
||||||
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
|
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
|
||||||
|
|
||||||
@ -59,13 +67,15 @@ jobs:
|
|||||||
if: success()
|
if: success()
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
|
set PATH=%NODE_PATH%;%PATH%
|
||||||
cd /d "%WORKSPACE_DIR%"
|
cd /d "%WORKSPACE_DIR%"
|
||||||
npm run build
|
npm run build
|
||||||
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
|
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 5. Deploy — robocopy exit codes 0-7 are all success
|
# 5. Deploy
|
||||||
# (bitmask of what changed: copied, skipped, etc.)
|
# /E = include subdirectories (even empty ones)
|
||||||
|
# /PURGE = remove destination files absent from source
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
if: success()
|
if: success()
|
||||||
@ -76,7 +86,7 @@ jobs:
|
|||||||
if %ERRORLEVEL% gtr 7 exit /b %ERRORLEVEL%
|
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
|
- name: Cleanup workspace
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user