-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (35 loc) · 1.35 KB
/
gh.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Deploy Frontend to GitHub Pages
on:
push:
branches: ["main"] # Change to your branch name if needed
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write # Ensure this permission is granted to your token
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16' # Update to your desired Node.js version
- name: Change directory to frontend (optional)
uses: actions/checkout@v4 # Checkout the specific directory (optional)
- working-directory: frontend # Set working directory for subsequent steps
run: |
npm install # Install dependencies within the frontend folder
npm run build # Build the frontend project
- name: Upload frontend build artifacts
uses: actions/upload-artifact@v4
with:
name: frontend-build # Customize the artifact name if needed
path: ./dist # Update path if your build output is in a different folder
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifact_name: frontend-build # Reference the uploaded artifact name
branch: gh-pages # Optional: deployment branch