Skip to content

Commit 828a16e

Browse files
authored
feat: updated github actions to match new repo structure (#138)
2 parents 9015f28 + ecebe72 commit 828a16e

2 files changed

Lines changed: 81 additions & 11 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: 'API: Extract Public Typings'
2+
3+
# 📘 This workflow verifies that API typings can be generated and rolled up cleanly.
4+
# It runs on:
5+
# - Pushes to `main` or `next` (validate committed state)
6+
# - PRs to any branch (validate incoming changes)
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
- next
13+
pull_request:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
extract-api-typings:
21+
name: Extract API Typings
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: ✅ Checkout Repository
26+
uses: actions/checkout@v4
27+
28+
- name: 🔍 Check if API directory exists
29+
id: check-dir
30+
run: |
31+
if [ ! -d "./api" ]; then
32+
echo "::notice::API directory not found - skipping API extraction"
33+
echo "api_exists=false" >> $GITHUB_OUTPUT
34+
else
35+
echo "✅ API directory found"
36+
echo "api_exists=true" >> $GITHUB_OUTPUT
37+
fi
38+
39+
- name: 🛠 Setup Node.js Environment
40+
if: steps.check-dir.outputs.api_exists == 'true'
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version-file: .nvmrc
44+
cache: 'npm'
45+
46+
- name: 💾 Restore npm Cache
47+
if: steps.check-dir.outputs.api_exists == 'true'
48+
uses: actions/cache@v3
49+
with:
50+
path: ~/.npm
51+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
52+
restore-keys: |
53+
${{ runner.os }}-node-
54+
55+
- name: 📦 Install Dependencies (npm ci)
56+
if: steps.check-dir.outputs.api_exists == 'true'
57+
working-directory: './api'
58+
run: npm ci
59+
60+
- name: 🧬 Run API Extractor
61+
if: steps.check-dir.outputs.api_exists == 'true'
62+
working-directory: './api'
63+
run: npm run api-extractor

.github/workflows/main.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,33 @@ name: Node PR Lint, Build and Test
22

33
# This workflow handles three scenarios:
44
#
5-
# 1. Push to `dev/*` branches:
5+
# 1. Push to `next`, `dev/*`, or `feature/*` branches:
66
# - Runs `code-quality-and-tests` and `integration-tests`
7-
# - Skips `build-and-package` to save time
7+
# - Skips `build-and-package` to save resources and focus on code quality
88
#
9-
# 2. Pull Requests to `main` (or rel/*):
9+
# 2. Pull Requests to `main` or `next`:
1010
# - Runs all jobs: code checks, tests, and packaging
11-
# - Used for full validation before merge
11+
# - Ensures complete validation including artifact generation before merge
1212
#
13-
# 3. Push to `main` or `rel/*`:
14-
# - Runs full workflow (same as PRs)
13+
# 3. Push to `main`:
14+
# - Runs full workflow for release validation and artifact generation
1515

1616
on:
1717
workflow_dispatch:
1818

1919
push:
2020
branches:
2121
- main
22-
- rel/*
22+
- next
2323
- dev/*
24+
- feature/*
2425

2526
pull_request:
2627
branches:
2728
- main
28-
- rel/*
29+
- next
2930
- dev/*
31+
- feature/*
3032

3133
concurrency:
3234
group: ${{ github.head_ref || github.run_id }}
@@ -102,14 +104,19 @@ jobs:
102104
- name: 🔄 Run Integration Tests (Headless UI)
103105
run: xvfb-run -a npm test
104106

105-
# Run only on push to `main` or for any PR (to any branch)
106-
# Skip on direct pushes to `dev/*` branches
107+
# Run only on push to `main` or for PRs to main or next
108+
# Skip on direct pushes to `next`, `dev/*`, and `feature/*` branches
107109
build-and-package:
108110
name: Build & Package Artifacts
109111
runs-on: ubuntu-latest
110112
needs: [code-quality-and-tests, integration-tests]
111113

112-
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/pull/')
114+
if: |
115+
github.ref == 'refs/heads/main' ||
116+
(startsWith(github.ref, 'refs/pull/') && (
117+
github.base_ref == 'main' ||
118+
github.base_ref == 'next'
119+
))
113120
114121
defaults:
115122
run:

0 commit comments

Comments
 (0)