Skip to content

Commit 7bfa4fd

Browse files
nchalla3claude
andcommitted
overhaul CI/CD pipeline and add CLAUDE.md
Replace the broken firebase-preview-deploy workflow with two focused workflows: - ci.yml: type check, lint, build, output verification, and preview channel deploy on PRs to main and non-main pushes; preview deploy is skipped for fork PRs with a clear job summary notice - deploy.yml: same validation steps followed by a production firebase deploy, triggered only on push to main Also adds CLAUDE.md with architecture overview and development commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6294766 commit 7bfa4fd

File tree

4 files changed

+258
-146
lines changed

4 files changed

+258
-146
lines changed

.github/workflows/ci.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches-ignore: [main]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
validate-and-preview:
15+
name: Validate & Preview Deploy
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 'lts/*'
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Type check
32+
run: npx tsc --noEmit
33+
34+
- name: Lint
35+
run: npm run lint
36+
37+
- name: Build
38+
run: npm run build
39+
40+
- name: Verify output files
41+
run: |
42+
FAILED=0
43+
for page in index team sponsors become-sponsor photos contact 404; do
44+
file="out/${page}.html"
45+
if [ ! -f "$file" ]; then
46+
echo "❌ Missing: $file"
47+
FAILED=1
48+
continue
49+
fi
50+
size=$(wc -c < "$file")
51+
if [ "$size" -lt 1000 ]; then
52+
echo "❌ $file is suspiciously small (${size} bytes) — possible build error"
53+
FAILED=1
54+
else
55+
echo "✅ $file (${size} bytes)"
56+
fi
57+
done
58+
exit $FAILED
59+
60+
# --- Preview deploy (skipped for fork PRs) ---
61+
62+
- name: Generate preview channel name
63+
id: channel
64+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
65+
run: |
66+
if [ "${{ github.event_name }}" = "pull_request" ]; then
67+
REF="pr-${{ github.event.pull_request.number }}"
68+
else
69+
REF="${{ github.ref_name }}"
70+
fi
71+
CLEAN_REF=$(echo "$REF" | sed 's/[^a-zA-Z0-9-]/-/g' | cut -c1-20)
72+
CHANNEL="preview-${CLEAN_REF}-${{ github.run_id }}"
73+
echo "name=$CHANNEL" >> $GITHUB_OUTPUT
74+
echo "Generated channel: $CHANNEL"
75+
76+
- name: Deploy to Firebase preview channel
77+
id: firebase-deploy
78+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
79+
env:
80+
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
81+
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
82+
run: |
83+
DEPLOY_OUTPUT=$(npx firebase hosting:channel:deploy "${{ steps.channel.outputs.name }}" \
84+
--project "$FIREBASE_PROJECT_ID" \
85+
--token "$FIREBASE_TOKEN" \
86+
--expires 7d \
87+
--non-interactive \
88+
--json)
89+
90+
PREVIEW_URL=$(echo "$DEPLOY_OUTPUT" | jq -r '.result[]?.url // empty')
91+
92+
if [ -n "$PREVIEW_URL" ]; then
93+
echo "url=$PREVIEW_URL" >> $GITHUB_OUTPUT
94+
echo "✅ Preview deployed: $PREVIEW_URL"
95+
else
96+
echo "❌ Failed to extract preview URL"
97+
echo "$DEPLOY_OUTPUT"
98+
exit 1
99+
fi
100+
101+
- name: Preview deployment summary
102+
if: steps.firebase-deploy.outputs.url != ''
103+
run: |
104+
cat >> $GITHUB_STEP_SUMMARY << EOF
105+
## 🔍 Preview Deployment
106+
107+
**Preview URL:** ${{ steps.firebase-deploy.outputs.url }}
108+
**Channel:** \`${{ steps.channel.outputs.name }}\`
109+
**Expires:** 7 days
110+
**Commit:** \`${{ github.sha }}\`
111+
EOF
112+
113+
- name: Fork PR notice
114+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
115+
run: |
116+
echo "ℹ️ Preview deploy skipped — this PR is from a fork."
117+
cat >> $GITHUB_STEP_SUMMARY << 'EOF'
118+
## ℹ️ Preview Deploy Skipped
119+
120+
This PR is from a forked repository. Firebase secrets are not available for fork PRs,
121+
so the preview deployment was skipped. All validation checks passed.
122+
EOF

.github/workflows/deploy.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Deploy to Production
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
# Do not cancel in-progress deploys — let each finish cleanly
8+
concurrency:
9+
group: deploy-production
10+
cancel-in-progress: false
11+
12+
jobs:
13+
build-and-deploy:
14+
name: Build, Validate & Deploy
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 'lts/*'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Type check
31+
run: npx tsc --noEmit
32+
33+
- name: Lint
34+
run: npm run lint
35+
36+
- name: Build
37+
run: npm run build
38+
39+
- name: Verify output files
40+
run: |
41+
FAILED=0
42+
for page in index team sponsors become-sponsor photos contact 404; do
43+
file="out/${page}.html"
44+
if [ ! -f "$file" ]; then
45+
echo "❌ Missing: $file"
46+
FAILED=1
47+
continue
48+
fi
49+
size=$(wc -c < "$file")
50+
if [ "$size" -lt 1000 ]; then
51+
echo "❌ $file is suspiciously small (${size} bytes) — possible build error"
52+
FAILED=1
53+
else
54+
echo "✅ $file (${size} bytes)"
55+
fi
56+
done
57+
exit $FAILED
58+
59+
- name: Deploy to Firebase
60+
env:
61+
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
62+
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
63+
run: |
64+
npx firebase deploy --only hosting \
65+
--project "$FIREBASE_PROJECT_ID" \
66+
--token "$FIREBASE_TOKEN" \
67+
--non-interactive
68+
69+
- name: Deployment summary
70+
run: |
71+
cat >> $GITHUB_STEP_SUMMARY << EOF
72+
## ✅ Production Deployment Successful
73+
74+
- **Branch:** \`${{ github.ref_name }}\`
75+
- **Commit:** \`${{ github.sha }}\`
76+
- **Triggered by:** ${{ github.actor }}
77+
EOF

.github/workflows/firebase-preview-deploy.yml

Lines changed: 0 additions & 146 deletions
This file was deleted.

0 commit comments

Comments
 (0)