Skip to content

Commit c274532

Browse files
ci: add robust argos-ui workflow
2 parents 019b460 + e9f4065 commit c274532

1 file changed

Lines changed: 35 additions & 21 deletions

File tree

.github/workflows/argos-ui.yml

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,57 @@ concurrency:
88
jobs:
99
ui:
1010
runs-on: ubuntu-latest
11-
defaults:
12-
run:
13-
working-directory: argos-ui # <- adjust if your UI folder name differs
1411
steps:
1512
- uses: actions/checkout@v4
1613

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+
1734
- uses: actions/setup-node@v4
1835
with:
1936
node-version: "20"
2037

21-
- name: Cache node_modules
22-
uses: actions/cache@v4
23-
with:
24-
path: |
25-
~/.npm
26-
argos-ui/node_modules
27-
key: ${{ runner.os }}-node-${{ hashFiles('argos-ui/package-lock.json', 'argos-ui/yarn.lock', 'argos-ui/pnpm-lock.yaml') }}
28-
29-
- name: Install deps
38+
- name: Install deps (guarded)
39+
if: env.ui_dir != ''
40+
working-directory: ${{ env.ui_dir }}
3041
run: |
31-
if [ -f package-lock.json ]; then npm ci --no-audit --no-fund;
32-
elif [ -f pnpm-lock.yaml ]; then npm i -g pnpm && pnpm i --frozen-lockfile;
33-
elif [ -f yarn.lock ]; then npm i -g yarn && yarn install --frozen-lockfile;
34-
else npm i; fi
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
3546
36-
- name: Lint/Test/Build (non-fatal if script missing)
47+
- name: Lint/Test/Build (non-fatal if missing)
48+
if: env.ui_dir != ''
49+
working-directory: ${{ env.ui_dir }}
3750
run: |
3851
npm run -s lint --if-present
3952
npm run -s test --if-present
4053
npm run -s build --if-present
4154
42-
- name: Upload build (if any)
55+
- name: Upload build / summary
4356
if: always()
4457
uses: actions/upload-artifact@v4
4558
with:
4659
name: argos-ui-build
4760
path: |
48-
dist
49-
build
50-
if-no-files-found: ignore
61+
${{ env.ui_dir }}/dist
62+
${{ env.ui_dir }}/build
63+
artifacts/*
64+
if-no-files-found: warn

0 commit comments

Comments
 (0)