Skip to content

Commit d2a7a67

Browse files
authored
Create vite.yml
1 parent b5a1943 commit d2a7a67

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/vite.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy NoteNest client
2+
on:
3+
push:
4+
branches: ["main"] # Change this to your default branch if it's different
5+
workflow_dispatch:
6+
permissions:
7+
contents: read
8+
pages: write
9+
id-token: write
10+
concurrency:
11+
group: "pages"
12+
cancel-in-progress: false
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
- name: Install dependencies
25+
run: |
26+
cd client # Navigate to the client folder
27+
npm ci
28+
29+
- name: Check if VITE_SERVER secret is available
30+
run: |
31+
if [ -z "${{ secrets.VITE_SERVER}}" ]; then
32+
echo "VITE_SERVER is not set. Cancelling the workflow."
33+
exit 1 # Exit the workflow if the secret is not found
34+
fi
35+
36+
- name: Copy .env file
37+
run: |
38+
cd client # Navigate to the client folder
39+
echo "VITE_SERVER=${{ secrets.VITE_SERVER}}" >> .env
40+
41+
- name: Build the VITE app
42+
run: |
43+
cd client # Navigate to the client folder
44+
npm run build
45+
46+
- name: Create 404.html for routing support
47+
run: |
48+
cd client # Navigate to the client folder
49+
cp dist/index.html dist/404.html
50+
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v3
53+
with:
54+
path: ./client/dist # Specify the path to the dist directory
55+
deploy:
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
runs-on: ubuntu-latest
60+
needs: build
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)