-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,33 @@ jobs: | |
build-and-deploy: | ||
runs-on: ubuntu-latest # 构建环境使用 ubuntu | ||
steps: | ||
- name: Checkout # 将代码拉到虚拟机 | ||
uses: actions/[email protected] | ||
- name: Checkout code # 将代码拉到虚拟机 | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
persist-credentials: false | ||
node-version: '18.18.0' | ||
|
||
- name: Install and Build # 下载依赖 打包项目 | ||
run: | ||
pnpm install | ||
pnpm build | ||
- name: Setup pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 8.12.0 | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Deploy # 部署 | ||
run: pnpm start:prod & | ||
- name: Build Next.js app | ||
run: pnpm build | ||
|
||
- name: Deploy to Custom Server | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} # 服务器IP或域名 | ||
username: ${{ secrets.SERVER_USERNAME }} # 服务器用户名 | ||
key: ${{ secrets.SERVER_SSH_KEY }} # 服务器SSH私钥 | ||
script: | | ||
cd /home/project/blog-web | ||
git pull origin master | ||
pnpm install --production | ||
pm2 restart app |