Skip to content

Commit 957332f

Browse files
authored
Merge pull request #919 from rahuldkjain/dev
feat: GPRG V2
2 parents 888aff3 + 17d7ab5 commit 957332f

File tree

131 files changed

+17130
-80347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+17130
-80347
lines changed

.all-contributorsrc

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"files": [
3-
"README.md"
4-
],
2+
"files": ["README.md"],
53
"imageSize": 100,
64
"commit": false,
75
"contributors": [
@@ -10,82 +8,63 @@
108
"name": "Sarbik Betal",
119
"avatar_url": "https://avatars2.githubusercontent.com/u/41508422?v=4",
1210
"profile": "https://github.com/sarbikbetal",
13-
"contributions": [
14-
"code"
15-
]
11+
"contributions": ["code"]
1612
},
1713
{
1814
"login": "Hardik0307",
1915
"name": "Hardik Bagada",
2016
"avatar_url": "https://avatars3.githubusercontent.com/u/41434099?v=4",
2117
"profile": "https://github.com/Hardik0307",
22-
"contributions": [
23-
"code"
24-
]
18+
"contributions": ["code"]
2519
},
2620
{
2721
"login": "antonkomarev",
2822
"name": "Anton Komarev",
2923
"avatar_url": "https://avatars0.githubusercontent.com/u/1849174?v=4",
3024
"profile": "https://komarev.com",
31-
"contributions": [
32-
"plugin"
33-
]
25+
"contributions": ["plugin"]
3426
},
3527
{
3628
"login": "KKVANONYMOUS",
3729
"name": "Kunal Kumar Verma",
3830
"avatar_url": "https://avatars3.githubusercontent.com/u/58628586?v=4",
3931
"profile": "https://kkvanonymous.github.io/",
40-
"contributions": [
41-
"code"
42-
]
32+
"contributions": ["code"]
4333
},
4434
{
4535
"login": "jaideepghosh",
4636
"name": "Jaideep Ghosh",
4737
"avatar_url": "https://avatars2.githubusercontent.com/u/3909648?v=4",
4838
"profile": "http://jaideepghosh.blogspot.com",
49-
"contributions": [
50-
"code"
51-
]
52-
}
39+
"contributions": ["code"]
40+
},
5341
{
5442
"login": "YashKandalkar",
5543
"name": "yash",
5644
"avatar_url": "https://avatars0.githubusercontent.com/u/35102959?v=4",
5745
"profile": "http://yashkandalkar.github.io",
58-
"contributions": [
59-
"code"
60-
]
46+
"contributions": ["code"]
6147
},
6248
{
6349
"login": "abhijit-hota",
6450
"name": "Abhijit Hota",
6551
"avatar_url": "https://avatars0.githubusercontent.com/u/8116174?v=4",
6652
"profile": "https://github.com/abhijit-hota",
67-
"contributions": [
68-
"code",
69-
"test"
70-
]
53+
"contributions": ["code", "test"]
7154
},
7255
{
7356
"login": "Maddoxx88",
7457
"name": "Sunit Shirke",
7558
"avatar_url": "https://avatars1.githubusercontent.com/u/34238672?v=4",
7659
"profile": "https://maddoxx88.github.io/",
77-
"contributions": [
78-
"code"
79-
]
80-
}
60+
"contributions": ["code"]
61+
},
8162
{
8263
"login": "g-savitha",
8364
"name": "Savitha Gollamudi",
8465
"avatar_url": "https://avatars0.githubusercontent.com/u/31612459?v=4",
8566
"profile": "https://www.gsavitha.in",
86-
"contributions": [
87-
"code"
88-
]
67+
"contributions": ["code"]
8968
}
9069
],
9170
"contributorsPerLine": 7,

.github/workflows/deploy.yml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
name: Build and Deploy
2+
3+
on:
4+
push:
5+
branches: [master, dev]
6+
pull_request:
7+
branches: [master, dev]
8+
9+
# Allow concurrent deployments for different environments
10+
concurrency:
11+
group: 'pages-${{ github.ref }}'
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Run type check
32+
run: npm run type-check
33+
34+
- name: Run linting
35+
run: npm run lint
36+
37+
- name: Run tests
38+
run: npm run test
39+
40+
- name: Build application
41+
run: |
42+
echo "Building for branch: ${{ github.ref_name }}"
43+
echo "NODE_ENV: $NODE_ENV"
44+
echo "SURGE_PREVIEW: $SURGE_PREVIEW"
45+
npm run build
46+
env:
47+
NEXT_PUBLIC_GA_ID: ${{ secrets.NEXT_PUBLIC_GA_ID }}
48+
NEXT_PUBLIC_REQUIRE_CONSENT: true
49+
NEXT_PUBLIC_ANONYMIZE_IP: true
50+
# Set SURGE_PREVIEW for non-master branches to disable basePath
51+
SURGE_PREVIEW: ${{ github.ref != 'refs/heads/master' && 'true' || '' }}
52+
53+
- name: Upload Pages Artifact (Production)
54+
if: github.ref == 'refs/heads/master'
55+
uses: actions/upload-pages-artifact@v3
56+
with:
57+
path: ./out
58+
59+
- name: Upload Preview Artifact
60+
if: github.ref != 'refs/heads/master'
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: preview-build-${{ github.run_number }}-${{ github.run_attempt }}
64+
path: ./out
65+
retention-days: 30
66+
67+
# Production deployment to main GitHub Pages
68+
deploy-production:
69+
needs: build
70+
runs-on: ubuntu-latest
71+
72+
# Only deploy to production from master branch
73+
if: github.ref == 'refs/heads/master'
74+
75+
permissions:
76+
pages: write
77+
id-token: write
78+
79+
environment:
80+
name: github-pages
81+
url: ${{ steps.deployment.outputs.page_url }}
82+
83+
steps:
84+
- name: Deploy to GitHub Pages
85+
id: deployment
86+
uses: actions/deploy-pages@v4
87+
88+
# Preview deployment for development branches
89+
deploy-preview:
90+
needs: build
91+
runs-on: ubuntu-latest
92+
93+
# Deploy preview for dev branches (not master, only on direct push)
94+
if: github.ref != 'refs/heads/master' && github.event_name == 'push'
95+
96+
# Add deployment environment to show URL in GitHub UI
97+
environment:
98+
name: preview-${{ github.ref_name }}
99+
100+
steps:
101+
- name: Calculate sanitized branch name
102+
id: branch
103+
run: |
104+
SANITIZED_BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9-]/-/g' | tr '[:upper:]' '[:lower:]')
105+
echo "sanitized=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT
106+
echo "url=https://gprg-${SANITIZED_BRANCH}.surge.sh" >> $GITHUB_OUTPUT
107+
- name: Debug deployment conditions
108+
run: |
109+
echo "GitHub ref: ${{ github.ref }}"
110+
echo "GitHub ref name: ${{ github.ref_name }}"
111+
echo "Event name: ${{ github.event_name }}"
112+
echo "Is master?: ${{ github.ref == 'refs/heads/master' }}"
113+
echo "Is push?: ${{ github.event_name == 'push' }}"
114+
echo "Should deploy?: ${{ github.ref != 'refs/heads/master' && github.event_name == 'push' }}"
115+
116+
- name: Download Preview Artifact
117+
uses: actions/download-artifact@v4
118+
with:
119+
name: preview-build-${{ github.run_number }}-${{ github.run_attempt }}
120+
path: ./preview-out
121+
122+
- name: Deploy to Surge.sh (Preview)
123+
id: deploy
124+
run: |
125+
npm install -g surge
126+
echo "Deploying preview for branch: ${{ github.ref_name }}"
127+
echo "Sanitized branch name: ${{ steps.branch.outputs.sanitized }}"
128+
echo "Preview URL: ${{ steps.branch.outputs.url }}"
129+
surge ./preview-out ${{ steps.branch.outputs.url }} --token ${{ secrets.SURGE_TOKEN }}
130+
echo "deployment_url=${{ steps.branch.outputs.url }}" >> $GITHUB_OUTPUT
131+
env:
132+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
133+
134+
- name: Comment PR with Preview URL
135+
if: github.event_name == 'pull_request'
136+
uses: actions/github-script@v7
137+
with:
138+
script: |
139+
const previewUrl = '${{ steps.deploy.outputs.deployment_url }}';
140+
141+
github.rest.issues.createComment({
142+
issue_number: context.issue.number,
143+
owner: context.repo.owner,
144+
repo: context.repo.repo,
145+
body: `🚀 **Preview Deployment Ready!**\n\n📱 Preview URL: ${previewUrl}\n\n*This preview will be available for 30 days.*`
146+
});
147+
148+
- name: Create deployment status
149+
uses: actions/github-script@v7
150+
with:
151+
script: |
152+
const previewUrl = '${{ steps.deploy.outputs.deployment_url }}';
153+
154+
// Create a commit status with the deployment URL
155+
github.rest.repos.createCommitStatus({
156+
owner: context.repo.owner,
157+
repo: context.repo.repo,
158+
sha: context.sha,
159+
state: 'success',
160+
target_url: previewUrl,
161+
description: `Preview deployed to ${previewUrl}`,
162+
context: 'deployment/preview'
163+
});
164+
165+
- name: Update Status Check
166+
run: |
167+
echo "🚀 Preview deployed successfully!"
168+
echo "📱 Preview URL: ${{ steps.deploy.outputs.deployment_url }}"
169+
echo ""
170+
echo "You can find this URL in:"
171+
echo "1. GitHub Actions > Environments tab"
172+
echo "2. Commit status checks"
173+
echo "3. This workflow run summary"
174+
175+
# Add to job summary for easy access
176+
echo "## 🚀 Preview Deployment Complete!" >> $GITHUB_STEP_SUMMARY
177+
echo "" >> $GITHUB_STEP_SUMMARY
178+
echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
179+
echo "**Preview URL:** [${{ steps.deploy.outputs.deployment_url }}](${{ steps.deploy.outputs.deployment_url }})" >> $GITHUB_STEP_SUMMARY
180+
echo "" >> $GITHUB_STEP_SUMMARY
181+
echo "### Where to find this URL:" >> $GITHUB_STEP_SUMMARY
182+
echo "- **Environments tab:** Go to your repository → Environments → preview-${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
183+
echo "- **Commit status:** Check the commit status checks for 'deployment/preview'" >> $GITHUB_STEP_SUMMARY
184+
echo "- **This summary:** Bookmark this workflow run for easy access" >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 34 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,45 @@
1-
dist/
2-
# Logs
3-
logs
4-
*.log
5-
npm-debug.log*
6-
yarn-debug.log*
7-
yarn-error.log*
8-
9-
# Runtime data
10-
pids
11-
*.pid
12-
*.seed
13-
*.pid.lock
14-
15-
# Directory for instrumented libs generated by jscoverage/JSCover
16-
lib-cov
17-
18-
# Coverage directory used by tools like istanbul
19-
coverage
20-
21-
# nyc test coverage
22-
.nyc_output
23-
24-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
25-
.grunt
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
262

27-
# Bower dependency directory (https://bower.io/)
28-
bower_components
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
2912

30-
# node-waf configuration
31-
.lock-wscript
13+
# testing
14+
/coverage
3215

33-
# Compiled binary addons (http://nodejs.org/api/addons.html)
34-
build/Release
16+
# next.js
17+
/.next/
18+
/out/
3519

36-
# Dependency directories
37-
node_modules/
38-
jspm_packages/
20+
# production
21+
/build
3922

40-
# Typescript v1 declaration files
41-
typings/
42-
43-
# Optional npm cache directory
44-
.npm
45-
46-
# Optional eslint cache
47-
.eslintcache
48-
49-
# Optional REPL history
50-
.node_repl_history
23+
# misc
24+
.DS_Store
25+
*.pem
5126

52-
# Output of 'npm pack'
53-
*.tgz
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
5432

55-
# dotenv environment variable files
33+
# env files (can opt-in for committing if needed)
5634
.env*
5735

58-
# gatsby files
59-
.cache/
60-
public
36+
# vercel
37+
.vercel
6138

62-
# Mac files
63-
.DS_Store
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts
6442

65-
# Yarn
66-
yarn-error.log
67-
.pnp/
68-
.pnp.js
69-
# Yarn Integrity file
70-
.yarn-integrity
43+
# Claude
44+
.cursor/
45+
.claude/

0 commit comments

Comments
 (0)