Skip to content

Commit 759d848

Browse files
authored
Merge pull request #21 from amankrs21/dev-v2
from dev-version-2 into main branch
2 parents 1f10888 + e52595b commit 759d848

File tree

91 files changed

+8935
-8372
lines changed

Some content is hidden

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

91 files changed

+8935
-8372
lines changed

.github/workflows/azure-static-web-apps-gray-field-039896a00.yml

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

.github/workflows/pipeline.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: CI/CD Pipeline for SonarCloud, Azure Web App, and Cloudflare Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev-v2
8+
pull_request:
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
jobs:
14+
# 1. SonarCloud Analysis Job
15+
sonarcloud-analysis:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: '20.x'
26+
27+
- name: Install dependencies
28+
run: npm install
29+
working-directory: ./client
30+
31+
- name: Run SonarCloud analysis
32+
uses: SonarSource/sonarcloud-github-action@4006f663ecaf1f8093e8e4abb9227f6041f52216
33+
env:
34+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
35+
with:
36+
args:
37+
-Dsonar.projectKey=amankrs21_Secure-Vault
38+
-Dsonar.organization=amankrs21
39+
projectBaseDir: .
40+
41+
42+
# 2. Express App Hosting Job (depends on SonarCloud success, but only runs on push to `main`)
43+
express-deployment:
44+
runs-on: ubuntu-latest
45+
needs: sonarcloud-analysis
46+
if: github.ref == 'refs/heads/main'
47+
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v3
51+
52+
- name: Set up Node.js
53+
uses: actions/setup-node@v3
54+
with:
55+
node-version: '20.x'
56+
57+
- name: Install dependencies for Express app
58+
run: npm install
59+
working-directory: ./server
60+
61+
- name: Zip artifact for deployment
62+
run: zip release.zip ./* -r
63+
64+
- name: Upload artifact for deployment job
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: node-app
68+
path: release.zip
69+
70+
# 3. Deploy to Azure Web App (depends on Express app deployment success)
71+
deploy-to-azure:
72+
runs-on: ubuntu-latest
73+
needs: express-deployment
74+
environment:
75+
name: 'Production'
76+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
77+
permissions:
78+
id-token: write
79+
if: github.ref == 'refs/heads/main'
80+
81+
steps:
82+
- name: Download artifact from build job
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: node-app
86+
87+
- name: Unzip artifact for deployment
88+
run: unzip release.zip
89+
90+
- name: Login to Azure
91+
uses: azure/login@v2
92+
with:
93+
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_C893E2C4A148480F887E7FC7AE540921 }}
94+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_D0B6632477BE4425A279ED0D006341AF }}
95+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_B302598FD9F549A3B424502161CA248F }}
96+
97+
- name: 'Deploy to Azure Web App'
98+
id: deploy-to-webapp
99+
uses: azure/webapps-deploy@v3
100+
with:
101+
app-name: 'secure-vault'
102+
slot-name: 'Production'
103+
package: ./server
104+
105+
# 4. React App Hosting to Cloudflare (depends on Azure Web App deployment success)
106+
react-deployment:
107+
runs-on: ubuntu-latest
108+
needs: deploy-to-azure
109+
if: github.ref == 'refs/heads/main'
110+
111+
steps:
112+
- name: Checkout repository
113+
uses: actions/checkout@v3
114+
115+
- name: Install dependencies for React app
116+
run: npm install
117+
working-directory: ./client
118+
119+
- name: Build React app
120+
run: npm run build
121+
working-directory: ./client
122+
123+
- name: Deploy to Cloudflare Pages
124+
uses: cloudflare/pages-action@v1
125+
with:
126+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
127+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
128+
projectName: 'securevault'
129+
directory: 'client/dist'

.gitignore

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
.vscode/
1+
client/node_modules
2+
server/node_modules
3+
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
pnpm-debug.log*
11+
lerna-debug.log*
12+
13+
node_modules
14+
dist
15+
dist-ssr
16+
*.local
17+
18+
# Editor directories and files
19+
.vscode/*
20+
!.vscode/extensions.json
21+
.idea
22+
.DS_Store
23+
*.suo
24+
*.ntvs*
25+
*.njsproj
26+
*.sln
27+
*.sw?
28+
29+
# ignore all .env files
30+
.env*
31+
32+
Scratch.txt

ProdCheck.md

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

0 commit comments

Comments
 (0)