All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m32s
- Remove gpu-worker.yml (no GPU server) - Fix ci.yml: install ssh/rsync in job container, remove GPU steps - Remove source mounts from l1-server and l1-worker so they use image code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
66 lines
2.0 KiB
YAML
66 lines
2.0 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
env:
|
|
REGISTRY: registry.rose-ash.com:5000
|
|
IMAGE_CPU: celery-l1-server
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install tools
|
|
run: |
|
|
apt-get update && apt-get install -y --no-install-recommends openssh-client rsync
|
|
|
|
- name: Set up SSH
|
|
env:
|
|
SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_KEY" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts 2>/dev/null || true
|
|
|
|
- name: Sync code to server
|
|
env:
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
run: |
|
|
rsync -avz --delete \
|
|
--exclude '.git' \
|
|
--exclude '__pycache__' \
|
|
--exclude '*.pyc' \
|
|
--exclude '.pytest_cache' \
|
|
--exclude 'venv' \
|
|
--exclude '.env' \
|
|
./ "root@$DEPLOY_HOST:/root/art-dag/celery/"
|
|
|
|
- name: Build and push image
|
|
env:
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
run: |
|
|
ssh "root@$DEPLOY_HOST" "
|
|
cd /root/art-dag/celery
|
|
docker build --build-arg CACHEBUST=\$(date +%s) -t ${{ env.REGISTRY }}/${{ env.IMAGE_CPU }}:latest -t ${{ env.REGISTRY }}/${{ env.IMAGE_CPU }}:${{ github.sha }} .
|
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_CPU }}:latest
|
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_CPU }}:${{ github.sha }}
|
|
"
|
|
|
|
- name: Deploy stack
|
|
env:
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
run: |
|
|
ssh "root@$DEPLOY_HOST" "
|
|
cd /root/art-dag/celery
|
|
docker stack deploy -c docker-compose.yml celery
|
|
echo 'Waiting for services to update...'
|
|
sleep 10
|
|
docker stack services celery
|
|
"
|