Skip to content

Deploy Nexent Community #32

Deploy Nexent Community

Deploy Nexent Community #32

Workflow file for this run

name: Deploy Nexent Community
on:
workflow_dispatch:
inputs:
deployment_mode:
description: 'Deployment mode: development or production'
required: true
default: 'development'
type: choice
options:
- development
- production
runner_label_json:
description: 'runner array in json format (e.g. ["ubuntu-latest"] or ["self-hosted"])'
required: true
default: '[]'
jobs:
build-main:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build main application image
run: docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple --build-arg APT_MIRROR=tsinghua -t nexent/nexent -f make/main/Dockerfile .
build-data-process:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if model is cached locally
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: 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 data process image
run: docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple --build-arg APT_MIRROR=tsinghua -t nexent/nexent-data-process -f make/data_process/Dockerfile .
build-web:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build web frontend image
run: docker build --build-arg MIRROR=https://registry.npmmirror.com --build-arg APK_MIRROR=tsinghua -t nexent/nexent-web -f make/web/Dockerfile .
build-docs:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build docs image
run: docker build --progress=plain -t nexent/nexent-docs -f make/docs/Dockerfile .
deploy:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
needs: [ build-main, build-data-process, build-web, build-docs ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Copy project to $HOME/nexent
run: |
rm -rf $HOME/nexent
mkdir -p $HOME/nexent
cp -r $GITHUB_WORKSPACE/* $HOME/nexent/
- name: Start docs container
run: |
docker stop nexent-docs 2>/dev/null || true
docker rm nexent-docs 2>/dev/null || true
docker run -d --name nexent-docs -p 4173:4173 nexent/nexent-docs
- 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
sed -i "s/APPID=.*/APPID=${{ secrets.VOICE_APPID }}/" .env
sed -i "s/TOKEN=.*/TOKEN=${{ secrets.VOICE_TOKEN }}/" .env
if [ "$DEPLOYMENT_MODE" = "production" ]; then
./deploy.sh --mode 3 --is-mainland N --enable-terminal N --version 2 --root-dir "$HOME/nexent-production-data"
else
./deploy.sh --mode 1 --is-mainland N --enable-terminal N --version 2 --root-dir "$HOME/nexent-development-data"
fi