Merge branch 'feat/improve-agent-prompt'
This commit is contained in:
24
.github/workflows/docker-build-deploy.yml
vendored
24
.github/workflows/docker-build-deploy.yml
vendored
@@ -7,7 +7,13 @@ on:
|
||||
paths:
|
||||
- 'api/**'
|
||||
- '.github/workflows/**'
|
||||
workflow_dispatch: # 允许手动触发
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: '部署分支'
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
|
||||
env:
|
||||
IMAGE_NAME: lifecho-api
|
||||
@@ -24,6 +30,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.ref }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
@@ -77,6 +85,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.ref }}
|
||||
|
||||
- name: Set up SSH
|
||||
uses: webfactory/ssh-agent@v0.9.0
|
||||
@@ -91,11 +101,12 @@ jobs:
|
||||
- name: Determine image tag
|
||||
id: image_tag
|
||||
run: |
|
||||
if [ "${{ github.ref_name }}" == "main" ] || [ "${{ github.ref_name }}" == "master" ]; then
|
||||
DEPLOY_BRANCH="${{ github.event.inputs.branch || github.ref_name }}"
|
||||
echo "deploy_branch=$DEPLOY_BRANCH" >> $GITHUB_OUTPUT
|
||||
if [ "$DEPLOY_BRANCH" == "main" ] || [ "$DEPLOY_BRANCH" == "master" ]; then
|
||||
echo "tag=latest" >> $GITHUB_OUTPUT
|
||||
else
|
||||
# 将分支名中的斜杠替换为破折号,以符合 Docker 标签规范
|
||||
BRANCH_TAG=$(echo "${{ github.ref_name }}" | sed 's/\//-/g')
|
||||
BRANCH_TAG=$(echo "$DEPLOY_BRANCH" | sed 's/\//-/g')
|
||||
echo "tag=$BRANCH_TAG" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
@@ -214,6 +225,11 @@ jobs:
|
||||
"docker exec -i life-echo-postgres psql -U $DB_USER -d $DB_NAME" \
|
||||
< api/migrations/add_chapter_is_active.sql
|
||||
|
||||
echo "添加用户基础资料字段..."
|
||||
ssh -p $SSH_PORT $SSH_USER@$SSH_HOST \
|
||||
"docker exec -i life-echo-postgres psql -U $DB_USER -d $DB_NAME" \
|
||||
< api/migrations/add_user_profile_fields.sql
|
||||
|
||||
echo "数据库迁移完成"
|
||||
|
||||
- name: Verify deployment
|
||||
|
||||
Reference in New Issue
Block a user