Skip to content

Commit 2523baf

Browse files
authored
Merge pull request #2 from helpdeveloper/github-action
feat: add github action
2 parents 37c49ee + 9b6d46e commit 2523baf

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and Deploy Static Export
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on any tag starting with 'v' (e.g., v1.0.0, v1.2.3)
7+
pull_request:
8+
branches: [main] # Build PRs for testing, but don't deploy
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20' # Updated to match project's Node version requirements
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm install
26+
27+
- name: Build static export
28+
run: npm run build # This will run next build which generates the 'out' directory
29+
30+
- name: Deploy to FTP
31+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
32+
uses: SamKirkland/[email protected]
33+
with:
34+
server: ${{ secrets.FTP_HOST }}
35+
username: ${{ secrets.FTP_USERNAME }}
36+
password: ${{ secrets.FTP_PASSWORD }}
37+
local-dir: ./out/
38+
# Update this to your target directory on the FTP server
39+
server-dir: /www # Change this to your desired directory path on the server
40+

0 commit comments

Comments
 (0)