Skip to content

Commit 40d0e59

Browse files
committed
Add CI/CD
1 parent 178cfdb commit 40d0e59

File tree

11 files changed

+6852
-1276
lines changed

11 files changed

+6852
-1276
lines changed

.github/actions/check/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "Check"
2+
description: "Run Checks"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Setup
7+
uses: ./.github/actions/setup
8+
- name: Run Checks
9+
shell: bash
10+
run: npm run check

.github/actions/deploy/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Deploy"
2+
description: "Deploy Apps"
3+
inputs:
4+
cloudflare_api_token:
5+
description: "the couldflare api token"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Setup
11+
uses: ./.github/actions/setup
12+
- name: Run Build
13+
shell: bash
14+
run: npm run build
15+
- name: Deploy To Cloudflare
16+
uses: cloudflare/wrangler-action@v3
17+
with:
18+
apiToken: ${{ inputs.cloudflare_api_token }}
19+
workingDirectory: "apps/web"
20+
command: wrangler pages deploy

.github/actions/setup/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Setup"
2+
description: "Setup the dependencies"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Cache Turbo Build Setup
7+
uses: actions/cache@v4
8+
with:
9+
path: .turbo
10+
key: ${{ runner.os }}-release-job-${{ github.sha }}
11+
restore-keys: |
12+
${{ runner.os }}-release-job-
13+
- name: Setup Node.js Environment
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
cache: "npm"
18+
- name: Install Dependencies
19+
shell: bash
20+
run: npm install

.github/actions/test/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "Test"
2+
description: "Run Tests"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Setup
7+
uses: ./.github/actions/setup
8+
- name: Run Tests
9+
shell: bash
10+
run: npm run test

.github/workflows/cicd.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- dev
9+
10+
permissions:
11+
id-token: write
12+
contents: read
13+
deployments: write
14+
15+
jobs:
16+
check:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check Out Code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 2
23+
- name: Run Checks
24+
uses: ./.github/actions/check
25+
26+
test:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Check Out Code
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 2
33+
- name: Run Tests
34+
uses: ./.github/actions/test
35+
36+
deploy:
37+
runs-on: ubuntu-latest
38+
needs:
39+
- check
40+
- test
41+
steps:
42+
- name: Check Out Code
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 2
46+
- name: Deploy App
47+
uses: ./.github/actions/deploy
48+
with:
49+
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ To add a npm package `pkg` use the following command:
5858

5959
```shell
6060
cd jeton
61-
npm install pkg --workspace=<YOUR PROJECT/WORKSPACE>
61+
npm install --workspace=<YOUR PROJECT/WORKSPACE> [--save|--save-dev] pkg
62+
```
63+
64+
For example:
65+
66+
```shell
67+
cd jeton
68+
npm install --workspace=apps/web --save-dev @cloudflare/next-on-pages
6269
```
6370

6471
### Lint Project

apps/web/app/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { Button } from "@jeton/ui/button";
22
import Image from "next/image";
33
import styles from "./page.module.css";
44

5+
export const runtime = "edge";
6+
57
export default function Home() {
68
return (
79
<div className={styles.page}>

apps/web/next.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
import { setupDevPlatform } from "@cloudflare/next-on-pages/next-dev";
2+
13
/** @type {import('next').NextConfig} */
24
const nextConfig = {};
35

6+
if (process.env.NODE_ENV === "development") {
7+
await setupDevPlatform();
8+
}
9+
410
export default nextConfig;

apps/web/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@
55
"scripts": {
66
"dev": "next dev --turbo",
77
"build": "next build",
8-
"start": "next start"
8+
"start": "next start",
9+
"next-on-pages:build": "npx @cloudflare/next-on-pages"
910
},
1011
"dependencies": {
1112
"@jeton/ui": "*",
13+
"next": "15.0.0-rc.0",
1214
"react": "19.0.0-rc-f994737d14-20240522",
13-
"react-dom": "19.0.0-rc-f994737d14-20240522",
14-
"next": "15.0.0-rc.0"
15+
"react-dom": "19.0.0-rc-f994737d14-20240522"
1516
},
1617
"devDependencies": {
18+
"@cloudflare/next-on-pages": "^1.13.2",
1719
"@jeton/typescript-config": "*",
18-
"typescript": "^5",
1920
"@types/node": "^20",
2021
"@types/react": "^18",
21-
"@types/react-dom": "^18"
22+
"@types/react-dom": "^18",
23+
"typescript": "^5"
2224
}
2325
}

apps/web/turbo.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://turbo.build/schema.json",
3+
"extends": ["//"],
4+
"tasks": {
5+
"build": {
6+
"dependsOn": ["next-on-pages:build"],
7+
"outputs": [".vercel/**"]
8+
},
9+
"next-on-pages:build": {}
10+
}
11+
}

0 commit comments

Comments
 (0)