File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy to server
2+ on :
3+ push :
4+ branches :
5+ - main
6+ jobs :
7+ build :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Checkout
11+ uses : actions/checkout@v4
12+
13+ - uses : pnpm/action-setup@v4
14+ name : Install pnpm
15+ with :
16+ version : 10
17+ run_install : false
18+
19+ - name : Install Node.js
20+ uses : actions/setup-node@v4
21+ with :
22+ node-version : 22
23+ cache : ' pnpm'
24+
25+ - name : Install dependencies
26+ run : pnpm install
27+
28+ - name : Setup Pages
29+ id : setup_pages
30+ uses : actions/configure-pages@v5
31+
32+ - name : Restore cache
33+ uses : actions/cache@v4
34+ with :
35+ path : |
36+ .next/cache
37+ # Generate a new cache whenever packages or source files change.
38+ key : ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
39+ # If source files changed but packages didn't, rebuild from a prior cache.
40+ restore-keys : |
41+ ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
42+ - name : Build
43+ run : pnpm run build
44+ - name : Deploy to Server
45+ uses : easingthemes/ssh-deploy@main
46+ with :
47+ # 本地.ssh文件下的私钥id_rsa,存在secrets的PRIVATE_KEY中
48+ SSH_PRIVATE_KEY : ${{ secrets.PRIVATE_KEY }}
49+ # 复制操作的参数。"-avzr --delete"意味部署时清空服务器目标目录下的文件
50+ ARGS : " -avz --delete"
51+ # 源目录
52+ SOURCE : " ./.next"
53+ # 部署目标主机
54+ REMOTE_HOST : ${{ secrets.HOST }}
55+ # 部署目标主机端口
56+ REMOTE_PORT : ${{ secrets.PORT }}
57+ # 登录用户
58+ REMOTE_USER : ${{ secrets.USER }}
59+ # 部署目标目录
60+ TARGET : ${{ secrets.TARGET }}
You can’t perform that action at this time.
0 commit comments