Skip to content

Commit 7b86af9

Browse files
committed
feat: add github action
1 parent 2faaeca commit 7b86af9

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build and Deploy Static Export
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: ['*']
8+
pull_request_target:
9+
types: [closed]
10+
branches: [main]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: '16' # Update this to match your project's Node version
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Build static export
30+
run: npm run build # This will run next build which generates the 'out' directory
31+
32+
- name: Deploy to FTP
33+
if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true
34+
uses: SamKirkland/FTP-Deploy-Action@4.3.0
35+
with:
36+
server: ${{ secrets.FTP_HOST }}
37+
username: ${{ secrets.FTP_USERNAME }}
38+
password: ${{ secrets.FTP_PASSWORD }}
39+
local-dir: ./out/
40+
# Update this to your target directory on the FTP server
41+
server-dir: / # Change this to your desired directory path on the server
42+

0 commit comments

Comments
 (0)