@@ -8,57 +8,57 @@ concurrency:
88jobs :
99 ui :
1010 runs-on : ubuntu-latest
11+ defaults :
12+ run :
13+ working-directory : apps/argos-ui # your UI folder
14+
1115 steps :
1216 - uses : actions/checkout@v4
13-
14- - name : Detect UI directory
15- id : detect
16- shell : bash
17- run : |
18- set -e
19- UI_DIR=""
20- for CAND in argos-ui ui web frontend apps/* packages/* .; do
21- if [ -f "$CAND/package.json" ]; then UI_DIR="$CAND"; break; fi
22- done
23- if [ -z "$UI_DIR" ]; then
24- UI_DIR=$(dirname "$(git ls-files '**/package.json' | head -n1)")
25- fi
26- echo "ui_dir=$UI_DIR" >> $GITHUB_ENV
27- echo "Detected UI dir: '${UI_DIR:-<none>}'"
28- if [ -z "$UI_DIR" ]; then
29- mkdir -p artifacts
30- echo "## argos-ui" > artifacts/ui-summary.md
31- echo "No UI folder with package.json found. Skipping build." >> artifacts/ui-summary.md
32- fi
33-
3417 - uses : actions/setup-node@v4
3518 with :
3619 node-version : " 20"
3720
38- - name : Install deps (guarded)
39- if : env.ui_dir != ''
40- working-directory : ${{ env.ui_dir }}
21+ # Install project deps with the detected package manager
22+ - name : Install deps
4123 run : |
42- if [ -f pnpm-lock.yaml ]; then npm i -g pnpm && pnpm i --frozen-lockfile; \
43- elif [ -f yarn.lock ]; then npm i -g yarn && yarn install --frozen-lockfile; \
44- elif [ -f package-lock.json ]; then npm ci --no-audit --no-fund; \
45- else npm install; fi
24+ if [ -f pnpm-lock.yaml ]; then
25+ npm i -g pnpm
26+ pnpm i --frozen-lockfile
27+ elif [ -f yarn.lock ]; then
28+ npm i -g yarn
29+ yarn install --frozen-lockfile
30+ elif [ -f package-lock.json ]; then
31+ npm ci --no-audit --no-fund
32+ else
33+ npm install
34+ fi
35+
36+ # Ensure TypeScript + types exist ONLY for this CI run
37+ # (so next/ESLint can type-check; no repo changes are pushed)
38+ - name : Ensure TS types for lint
39+ run : |
40+ if [ -f tsconfig.json ]; then
41+ if [ -f pnpm-lock.yaml ]; then
42+ pnpm add -D typescript @types/react @types/node
43+ elif [ -f yarn.lock ]; then
44+ yarn add -D typescript @types/react @types/node
45+ else
46+ npm i -D --no-save typescript @types/react @types/node
47+ fi
48+ fi
4649
47- - name : Lint/Test/Build (non-fatal if missing)
48- if : env.ui_dir != ''
49- working-directory : ${{ env.ui_dir }}
50+ - name : Lint/Test/Build (non-fatal if scripts missing)
5051 run : |
5152 npm run -s lint --if-present
5253 npm run -s test --if-present
5354 npm run -s build --if-present
5455
55- - name : Upload build / summary
56+ - name : Upload build (if any)
5657 if : always()
5758 uses : actions/upload-artifact@v4
5859 with :
5960 name : argos-ui-build
6061 path : |
61- ${{ env.ui_dir }}/dist
62- ${{ env.ui_dir }}/build
63- artifacts/*
62+ dist
63+ build
6464 if-no-files-found : warn
0 commit comments