Skip to content

Update deploy workflow for two-stage deployment (build on backup, dep… #3

Update deploy workflow for two-stage deployment (build on backup, dep…

Update deploy workflow for two-stage deployment (build on backup, dep… #3

Workflow file for this run

name: Deploy Bot to Production
on:
push:
branches:
- main
- master
workflow_dispatch:
jobs:
# Build on backup first to test, but don't start (bot only runs on production)
build-backup:
runs-on: [self-hosted, backup]
name: Build on Backup Server
steps:
- name: Build Bot on Backup (standby)
run: |
echo "Building bot on BACKUP server (standby mode)..."
cd /opt/Lokus-Prod/services/bot
git fetch origin
git reset --hard origin/main || git reset --hard origin/master
cd /opt/Lokus-Prod/stacks/bot
docker-compose build
echo "Build complete! Bot ready for failover if needed."
- name: Discord Notification (Build)
if: failure()
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: failure
title: "Bot Build FAILED on Backup"
description: |
Build failed! Production deploy cancelled.
Commit: ${{ github.sha }}
By: ${{ github.actor }}
url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
deploy-production:
needs: build-backup
runs-on: [self-hosted, production]
name: Deploy to Production Server
steps:
- name: Deploy Bot to Production
run: |
echo "Starting bot deployment to PRODUCTION server..."
/opt/Lokus-Prod/scripts/deploy-bot.sh
echo "Production deployment complete!"
- name: Discord Notification
if: always()
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
title: "Bot Deployment"
description: |
Deployed to production (backup ready for failover)
Commit: ${{ github.sha }}
Branch: ${{ github.ref_name }}
By: ${{ github.actor }}
url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}