Skip to content

Deploy Nexent Community #2

Deploy Nexent Community

Deploy Nexent Community #2

Workflow file for this run

name: Deploy Nexent Community
on:
workflow_dispatch:
inputs:
deployment_mode:
description: '部署模式: development or production'
required: true
default: 'development'
type: choice
options:
- development
- production
runner_label_json:
description: 'JSON 格式的 runner 标签数组'
required: true
default: '[]'
jobs:
build-images:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
strategy:
matrix:
target: [main, data-process, web]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
retries: 3
# Data process specific cache handling
- name: Check if model is cached locally
if: matrix.target == 'data-process'
id: check-model
run: |
if [ -f ~/model-assets/clip-vit-base-patch32/config.json ] && [ -d ~/model-assets/nltk_data ]; then
echo "cache-hit=true" >> "$GITHUB_OUTPUT"
cp -r ~/model-assets ./
else
echo "cache-hit=false" >> "$GITHUB_OUTPUT"
fi
- name: Clone model if not cached
if: matrix.target == 'data-process' && steps.check-model.outputs.cache-hit == 'false'
run: |
GIT_LFS_SKIP_SMUDGE=1 git clone https://hf-mirror.com/Nexent-AI/model-assets
cd ./model-assets
GIT_TRACE=1 GIT_CURL_VERBOSE=1 GIT_LFS_LOG=debug git lfs pull
rm -rf .git .gitattributes
- name: Build docker image
run: |
if [ "${{ matrix.target }}" = "main" ]; then
docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple -t nexent/nexent -f make/main/Dockerfile .
elif [ "${{ matrix.target }}" = "data-process" ]; then
docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple -t nexent/nexent-data-process -f make/data_process/Dockerfile .
else
docker build --build-arg MIRROR=https://registry.npmmirror.com -t nexent/nexent-web -f make/web/Dockerfile .
fi
deploy:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
needs: build-images
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
retries: 3
- name: Copy project to $HOME/nexent
run: |
rm -rf $HOME/nexent
mkdir -p $HOME/nexent
cp -r $GITHUB_WORKSPACE/* $HOME/nexent/
- name: Ensure deploy.sh is executable
run: chmod +x $HOME/nexent/docker/deploy.sh
- name: Deploy with deploy.sh
env:
DEPLOYMENT_MODE: ${{ github.event.inputs.deployment_mode }}
run: |
cd $HOME/nexent/docker
cp .env.example .env
if [ "$DEPLOYMENT_MODE" = "production" ]; then
./deploy.sh --mode 3 --is-mainland N --enable-terminal N
else
./deploy.sh --mode 1 --is-mainland N --enable-terminal N
fi