Skip to content

Merge feat/edit-recipes-search: 编辑已保存菜谱(含单位)+ 按菜名搜索 #6

Merge feat/edit-recipes-search: 编辑已保存菜谱(含单位)+ 按菜名搜索

Merge feat/edit-recipes-search: 编辑已保存菜谱(含单位)+ 按菜名搜索 #6

Workflow file for this run

name: Deploy Kitchen Notebook
on:
push:
branches:
- main # Trigger deployment on push to main branch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Deploy to Server via SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SERVER_HOST }} # Server IP address
username: ${{ secrets.SERVER_USER }} # SSH username (e.g., root)
key: ${{ secrets.SERVER_SSH_KEY }} # SSH private key
port: ${{ secrets.SERVER_PORT }} # SSH port (usually 22)
script: |
# Source NVM so we can use npm and pm2 in this non-interactive shell
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# Navigate to project directory (set this in GitHub Secrets)
cd ${{ secrets.PROJECT_PATH }}
# Pull latest code
git pull origin main
# Install dependencies
npm install
# Build frontend assets
npm run build
# Restart the node process via PM2 (ensure pm2 is installed globally)
# Note: The first time you'll need to run this on your server manually:
# `pm2 start server/index.js --name kitchen-notebook`
pm2 restart kitchen-notebook
echo "✅ Deployment Successful!"