Skip to content

Commit 6405bf9

Browse files
committed
ci: restrict workflow triggers to relevant paths and enforce frozen lockfile for dependency installation
1 parent 2d016b5 commit 6405bf9

2 files changed

Lines changed: 63 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,39 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
build_test_lint:
11-
name: Build, Test, and Lint
10+
# ── 1. Detección de Cambios ────────────────────────────────────────────────
11+
changes:
1212
runs-on: ubuntu-latest
13-
13+
outputs:
14+
lib: ${{ steps.filter.outputs.lib }}
15+
demo: ${{ steps.filter.outputs.demo }}
1416
steps:
15-
- name: Checkout repository
16-
uses: actions/checkout@v4
17+
- uses: actions/checkout@v4
18+
- uses: dorny/paths-filter@v3
19+
id: filter
20+
with:
21+
filters: |
22+
lib:
23+
- 'projects/ngx-theme-stack/**'
24+
- 'package.json'
25+
- 'pnpm-lock.yaml'
26+
demo:
27+
- 'projects/demo-ngx-theme-stack/**'
28+
- 'package.json'
29+
- 'pnpm-lock.yaml'
1730
18-
- name: Install pnpm
19-
uses: pnpm/action-setup@v4
31+
# ── 2. Job para la Librería ────────────────────────────────────────────────
32+
library:
33+
needs: changes
34+
if: ${{ needs.changes.outputs.lib == 'true' }}
35+
name: Test & Build Library
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: pnpm/action-setup@v4
2040
with:
2141
version: 10.30.3
22-
23-
- name: Setup Node.js
24-
uses: actions/setup-node@v4
42+
- uses: actions/setup-node@v4
2543
with:
2644
node-version: '20'
2745
cache: 'pnpm'
@@ -37,3 +55,25 @@ jobs:
3755

3856
- name: Build Library
3957
run: pnpm exec ng build ngx-theme-stack
58+
59+
# ── 3. Job para la Demo ───────────────────────────────────────────────────
60+
demo:
61+
needs: changes
62+
if: ${{ needs.changes.outputs.demo == 'true' }}
63+
name: Build Demo App
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: pnpm/action-setup@v4
68+
with:
69+
version: 10.30.3
70+
- uses: actions/setup-node@v4
71+
with:
72+
node-version: '20'
73+
cache: 'pnpm'
74+
75+
- name: Install dependencies
76+
run: pnpm install --frozen-lockfile
77+
78+
- name: Build Demo
79+
run: pnpm run build:demo

.github/workflows/deploy.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@ name: Deploy Demo to Cloudflare Pages
33
on:
44
push:
55
branches: [ main ]
6+
paths:
7+
- 'projects/demo-ngx-theme-stack/**'
8+
- 'projects/ngx-theme-stack/**'
9+
- 'package.json'
10+
- 'pnpm-lock.yaml'
11+
- '.github/workflows/deploy.yml'
612
pull_request:
713
branches: [ main ]
14+
paths:
15+
- 'projects/demo-ngx-theme-stack/**'
16+
- 'projects/ngx-theme-stack/**'
17+
- 'package.json'
18+
- 'pnpm-lock.yaml'
19+
- '.github/workflows/deploy.yml'
820
workflow_dispatch:
921

1022
jobs:
@@ -26,7 +38,7 @@ jobs:
2638
cache: 'pnpm'
2739

2840
- name: Install dependencies
29-
run: pnpm install
41+
run: pnpm install --frozen-lockfile
3042

3143
- name: Build library and schematics
3244
run: pnpm run build:lib

0 commit comments

Comments
 (0)