Skip to content

Commit 4b93fea

Browse files
Repair build and deployment workflows
1 parent 70fe27a commit 4b93fea

3 files changed

Lines changed: 54 additions & 140 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,39 @@
1-
# ------------------------------------------------------------
2-
# Workflow: Continuous Integration (CI)
3-
# ------------------------------------------------------------
4-
# Purpose:
5-
# This workflow validates the health of the Magic2U monorepo
6-
# on every pull request and every push to the main branch.
7-
#
8-
# Why this matters:
9-
# - Prevents broken builds from entering main
10-
# - Ensures TypeScript, linting, and tests stay green
11-
# - Guarantees that all packages in the monorepo compile
12-
# - Creates a predictable, stable development experience
13-
#
14-
# Trigger:
15-
# - Runs on all pull requests (quality gate before merging)
16-
# - Runs on pushes to main (protects production branch)
17-
# ------------------------------------------------------------
18-
191
name: CI
202

213
on:
22-
pull_request: # Validate all incoming PRs
234
push:
24-
branches: [main] # Re-run CI when main is updated
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: read
2511

2612
jobs:
2713
build:
28-
runs-on: ubuntu-latest # GitHub-hosted Linux runner
14+
runs-on: ubuntu-latest
2915

3016
steps:
31-
# --------------------------------------------------------
32-
# Step 1: Checkout repository
33-
# --------------------------------------------------------
34-
# Pulls down the repository code so the workflow can run
35-
# builds, tests, and linting against the actual source.
36-
- uses: actions/checkout@v3
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v4
3722

38-
# --------------------------------------------------------
39-
# Step 2: Install pnpm
40-
# --------------------------------------------------------
41-
# Magic2U uses pnpm as the monorepo package manager.
42-
# This step ensures the correct version is installed.
43-
- uses: pnpm/action-setup@v2
23+
- name: Install Node.js
24+
uses: actions/setup-node@v4
4425
with:
45-
version: 8
26+
node-version: 22
27+
cache: pnpm
4628

47-
# --------------------------------------------------------
48-
# Step 3: Install dependencies
49-
# --------------------------------------------------------
50-
# Installs all workspace dependencies using pnpm.
51-
# Benefits:
52-
# - deterministic lockfile
53-
# - fast, cached installs
54-
# - efficient monorepo linking
55-
- run: pnpm install
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
5631

57-
# --------------------------------------------------------
58-
# Step 4: Build the monorepo
59-
# --------------------------------------------------------
60-
# Runs "pnpm build", which triggers Turbo to:
61-
# - build all packages in dependency order
62-
# - cache build outputs
63-
# - ensure no package has a broken build
64-
- run: pnpm build
32+
- name: Build product
33+
run: pnpm build
6534

66-
# --------------------------------------------------------
67-
# Step 5: Lint the codebase
68-
# --------------------------------------------------------
69-
# Ensures code quality and consistency across:
70-
# - apps
71-
# - packages
72-
# - tooling
73-
#
74-
# Prevents stylistic drift and catches common errors early.
75-
- run: pnpm lint
35+
- name: Run lint checks
36+
run: pnpm lint
7637

77-
# --------------------------------------------------------
78-
# Step 6: Run test suite
79-
# --------------------------------------------------------
80-
# Executes all unit tests across the monorepo.
81-
# Ensures:
82-
# - components behave correctly
83-
# - utilities remain stable
84-
# - regressions are caught before merging
85-
- run: pnpm test
38+
- name: Run tests when available
39+
run: pnpm run --if-present test

.github/workflows/deploy-pages.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ jobs:
2525

2626
- name: Install pnpm
2727
uses: pnpm/action-setup@v4
28-
with:
29-
version: 8.15.8
3028

3129
- name: Install Node.js
3230
uses: actions/setup-node@v4
3331
with:
34-
node-version: 20
32+
node-version: 22
3533
cache: pnpm
3634

3735
- name: Install dependencies
@@ -43,7 +41,7 @@ jobs:
4341
- name: Configure GitHub Pages
4442
uses: actions/configure-pages@v5
4543

46-
- name: Upload website
44+
- name: Upload production website
4745
uses: actions/upload-pages-artifact@v3
4846
with:
4947
path: apps/studio/dist
@@ -57,6 +55,6 @@ jobs:
5755
needs: build
5856

5957
steps:
60-
- name: Deploy website
58+
- name: Deploy production website
6159
id: deployment
6260
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 27 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,36 @@
1-
# ------------------------------------------------------------
2-
# Workflow: Release
3-
# ------------------------------------------------------------
4-
# Purpose:
5-
# This workflow automates the final step of the Magic2U
6-
# release pipeline: publishing updated packages to npm.
7-
#
8-
# It is triggered ONLY when code is pushed to the main branch.
9-
# Typically, this happens when a "Version Packages" PR created
10-
# by Changesets is merged.
11-
#
12-
# Why this matters:
13-
# - Ensures releases are consistent and reproducible
14-
# - Eliminates manual publishing steps
15-
# - Guarantees that version bumps + changelogs are applied
16-
# - Publishes all updated packages in the monorepo
17-
#
18-
# This workflow is the final stage of your CI/CD pipeline.
19-
# ------------------------------------------------------------
20-
21-
name: Release
1+
name: Release Readiness
222

233
on:
24-
push:
25-
branches: [main] # Only publish when main is updated
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
268

279
jobs:
28-
publish:
29-
runs-on: ubuntu-latest # GitHub-hosted Linux runner
10+
validate:
11+
runs-on: ubuntu-latest
3012

3113
steps:
32-
# --------------------------------------------------------
33-
# Step 1: Checkout repository
34-
# --------------------------------------------------------
35-
# Pulls down the latest version of the main branch.
36-
# Required so the workflow can build and publish packages.
37-
- uses: actions/checkout@v3
14+
- name: Check out repository
15+
uses: actions/checkout@v4
16+
17+
- name: Install pnpm
18+
uses: pnpm/action-setup@v4
19+
20+
- name: Install Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 22
24+
cache: pnpm
25+
26+
- name: Install dependencies
27+
run: pnpm install --frozen-lockfile
3828

39-
# --------------------------------------------------------
40-
# Step 2: Install dependencies
41-
# --------------------------------------------------------
42-
# Installs all workspace dependencies using pnpm.
43-
# Ensures:
44-
# - deterministic lockfile usage
45-
# - consistent builds
46-
# - correct dependency graph for publishing
47-
- run: pnpm install
29+
- name: Build release candidate
30+
run: pnpm build
4831

49-
# --------------------------------------------------------
50-
#
32+
- name: Run lint checks
33+
run: pnpm lint
5134

52-
# --------------------------------------------------------
53-
# Step 3: Build the monorepo
54-
# --------------------------------------------------------
55-
# Runs the full build across all packages. # This ensures:
56-
# - packages compile successfully
57-
# - type declarations are generated
58-
# - build artifacts exist before publishing
59-
#
60-
# Turbo handles dependency ordering automatically.
61-
- run: pnpm build
62-
# --------------------------------------------------------
63-
# Step 4: Publish updated packages
64-
# --------------------------------------------------------
65-
# "pnpm release" is your Changesets publish command.
66-
#
67-
# It:
68-
# - reads pending changesets
69-
# - applies version bumps
70-
# - generates changelogs
71-
# - publishes updated packages to npm
72-
#
73-
# This step is the heart of your automated release pipeline.
74-
- run: pnpm release
35+
- name: Run tests when available
36+
run: pnpm run --if-present test

0 commit comments

Comments
 (0)