Skip to content
This repository was archived by the owner on May 4, 2025. It is now read-only.

Commit 26ab251

Browse files
committed
Changed workflow and added new one for validation
1 parent 92b43a9 commit 26ab251

File tree

5 files changed

+114
-9
lines changed

5 files changed

+114
-9
lines changed

.github/workflows/production-site.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ name: Deploy static content to Pages
44
on:
55
# Runs on pushes targeting the default branch
66
push:
7-
branches: ['main']
8-
7+
branches: ["main"]
98
# Allows you to run this workflow manually from the Actions tab
109
workflow_dispatch:
1110

@@ -17,7 +16,7 @@ permissions:
1716

1817
# Allow one concurrent deployment
1918
concurrency:
20-
group: 'pages'
19+
group: "pages"
2120
cancel-in-progress: true
2221

2322
jobs:
@@ -30,19 +29,45 @@ jobs:
3029
steps:
3130
- name: Checkout
3231
uses: actions/checkout@v4
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: "20"
37+
3338
- name: Setup pnpm
3439
uses: pnpm/action-setup@v4
40+
with:
41+
version: 8
42+
run_install: false
43+
44+
- name: Get pnpm store directory
45+
shell: bash
46+
run: |
47+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
48+
49+
- name: Setup pnpm cache
50+
uses: actions/cache@v4
51+
with:
52+
path: ${{ env.STORE_PATH }}
53+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
54+
restore-keys: |
55+
${{ runner.os }}-pnpm-store-
56+
3557
- name: Install dependencies
36-
run: pnpm i
58+
run: pnpm install --frozen-lockfile
59+
3760
- name: Build
3861
run: pnpm run build
62+
3963
- name: Setup Pages
4064
uses: actions/configure-pages@v4
65+
4166
- name: Upload artifact
4267
uses: actions/upload-pages-artifact@v3
4368
with:
44-
# Upload dist folder
45-
path: './dist'
69+
path: "./dist"
70+
4671
- name: Deploy to GitHub Pages
4772
id: deployment
48-
uses: actions/deploy-pages@v4
73+
uses: actions/deploy-pages@v4
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Validate Project Data
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "data.json"
7+
8+
jobs:
9+
validate:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up Node.js
14+
uses: actions/setup-node@v2
15+
with:
16+
node-version: "16"
17+
18+
- name: Install dependencies
19+
run: npm install ajv
20+
21+
- name: Validate JSON
22+
run: |
23+
node -e "
24+
const Ajv = require('ajv');
25+
const ajv = new Ajv();
26+
const schema = {
27+
type: 'object',
28+
required: ['projects'],
29+
properties: {
30+
projects: {
31+
type: 'array',
32+
items: {
33+
type: 'object',
34+
required: ['studentName', 'projectName', 'description', 'tags', 'githubLink', 'image'],
35+
properties: {
36+
id: { type: 'number' },
37+
studentName: { type: 'string', minLength: 1 },
38+
projectName: { type: 'string', minLength: 1 },
39+
description: { type: 'string', maxLength: 100 },
40+
tags: {
41+
type: 'array',
42+
items: { type: 'string' },
43+
minItems: 1
44+
},
45+
demoLink: { type: 'string', format: 'uri' },
46+
githubLink: { type: 'string', format: 'uri' },
47+
image: {
48+
type: 'string',
49+
format: 'uri',
50+
pattern: '\\.(jpg|jpeg|png|gif)$'
51+
}
52+
}
53+
}
54+
}
55+
}
56+
};
57+
58+
const data = require('./data.json');
59+
const valid = ajv.validate(schema, data);
60+
61+
if (!valid) {
62+
console.error('Validation errors:', ajv.errors);
63+
process.exit(1);
64+
}
65+
"
66+
67+
- name: Check for duplicate projects
68+
run: |
69+
node -e "
70+
const data = require('./data.json');
71+
const projects = data.projects;
72+
const names = new Set();
73+
for (const project of projects) {
74+
if (names.has(project.projectName)) {
75+
console.error('Duplicate project name:', project.projectName);
76+
process.exit(1);
77+
}
78+
names.add(project.projectName);
79+
}
80+
"

.nojekyll

Whitespace-only changes.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Copy and fill out this template:
1414
"projectName": "Your Project Name",
1515
"description": "A brief description of your project (max 100 characters)",
1616
"tags": ["Tag1", "Tag2", "Tag3"], // Choose relevant technologies/categories
17-
"demoLink": "https://your-demo-link.com", // Optional
17+
"demoLink": "https://your-demo-link.com",
1818
"githubLink": "https://github.com/your-username/your-repo",
1919
"image": "https://link-to-your-project-image.com" // Must be a direct image link
2020
}

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import tailwindcss from "@tailwindcss/vite";
44

55
// https://vite.dev/config/
66
export default defineConfig({
7-
base: "/breakpoint/",
7+
base: "/Breakpoint/",
88
plugins: [react(), tailwindcss()],
99
});

0 commit comments

Comments
 (0)