Skip to content

Commit 55ebc56

Browse files
committed
github workflows
1 parent f7dfc88 commit 55ebc56

File tree

5 files changed

+455
-7
lines changed

5 files changed

+455
-7
lines changed

.github/workflows/cd.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: deploy to production
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
deploy:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: amondnet/vercel-action@v25
10+
with:
11+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
12+
github-token: ${{ secrets.GITHUB_TOKEN }}
13+
vercel-args: '--prod'
14+
vercel-org-id: ${{ secrets.ORG_ID}}
15+
vercel-project-id: ${{ secrets.PROD_PROJECT_ID }}
16+
working-directory: ./
17+
alias-domains: https://blogger-prod.vercel.app/

.github/workflows/ci.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Continuous Integration Workflow
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
Tests:
17+
name: 'Run Tests'
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
# Step 1: Checkout the code
22+
- name: Checkout Code
23+
uses: actions/checkout@v2
24+
25+
# Step 2: Set up Node.js environment
26+
- name: Install Node.js
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: 20.11.1
30+
cache: 'npm'
31+
32+
# Step 3: Install dependencies & tests
33+
- name: Install Dependency & Test
34+
working-directory: ./
35+
run: |
36+
npm install
37+
38+
39+
Lint:
40+
needs: Tests
41+
name: 'Run linter'
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
# Step 1: Checkout the code
46+
- name: Checkout Code
47+
uses: actions/checkout@v2
48+
49+
# Step 2: Install dependencies
50+
- name: 'Install Dependencies'
51+
run: npm install
52+
53+
# Step 3: Run linting and tests
54+
- name: 'Run linter'
55+
run: npm run lint
56+
57+
# Step 4: Build the application
58+
- name: Build Next.js app
59+
run: npm run build

.github/workflows/staging.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: deploy to staging
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
PR_number:
6+
description: 'Pull request number'
7+
required: true
8+
jobs:
9+
staging:
10+
runs-on: ubuntu-latest
11+
steps:
12+
# Step 1: Checkout Pull Request Code
13+
- name: Checkout Pull Request Code
14+
uses: actions/checkout@v2
15+
with:
16+
ref: refs/pull/${{ github.event.inputs.PR_number }}/merge
17+
18+
# Step 2: Deploy to Staging
19+
- name: Deploy to Vercel
20+
uses: amondnet/vercel-action@v25
21+
with:
22+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
23+
github-token: ${{ secrets.GITHUB_TOKEN }}
24+
vercel-args: '--preview'
25+
vercel-org-id: ${{ secrets.ORG_ID}}
26+
vercel-project-id: ${{ secrets.STAGING_PROJECT_ID }}
27+
working-directory: ./
28+
alias-domains: pr-${{ github.event.inputs.PR_number }}.staging.dev
29+

0 commit comments

Comments
 (0)