Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kangood authored May 24, 2024
1 parent a2793f8 commit 375cbde
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 375cbde

Please sign in to comment.