Skip to content

fix: Start health server immediately, skip pre-ingestion in start.sh #2

fix: Start health server immediately, skip pre-ingestion in start.sh

fix: Start health server immediately, skip pre-ingestion in start.sh #2

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
- staging
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'staging'
type: choice
options:
- staging
- production
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Pre-deploy Tests
uses: ./.github/workflows/test.yml

Check failure on line 26 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy.yml

Invalid workflow file

error parsing called workflow ".github/workflows/deploy.yml" -> "./.github/workflows/test.yml" (source branch with sha:e50dce8052ec997718caa3d3ee256ed28d7374d5) : workflow is not reusable as it is missing a `on.workflow_call` trigger
build:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [test]
permissions:
contents: read
packages: write
outputs:
image_tag: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/staging' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'staging')
environment:
name: staging
url: https://staging.mudrex-copilot.railway.app
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Railway CLI
run: npm install -g @railway/cli
- name: Deploy to Railway Staging
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_STAGING }}
run: |
railway link ${{ secrets.RAILWAY_PROJECT_ID_STAGING }}
railway up --detach
- name: Wait for deployment health
run: |
echo "Waiting for deployment to be healthy..."
sleep 60
# Health check would go here
- name: Notify deployment success
if: success()
run: echo "Successfully deployed to staging"
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production')
environment:
name: production
url: https://mudrex-copilot.railway.app
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Railway CLI
run: npm install -g @railway/cli
- name: Deploy to Railway Production
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_PRODUCTION }}
run: |
railway link ${{ secrets.RAILWAY_PROJECT_ID_PRODUCTION }}
railway up --detach
- name: Wait for deployment health
run: |
echo "Waiting for deployment to be healthy..."
sleep 60
# Health check
curl -f ${{ vars.HEALTH_URL }}/health/live || exit 1
- name: Notify deployment success
if: success()
run: echo "Successfully deployed to production"
rollback:
name: Rollback on Failure
runs-on: ubuntu-latest
needs: [deploy-staging, deploy-production]
if: failure()
steps:
- name: Notify deployment failure
run: |
echo "Deployment failed - manual rollback may be required"
# Add notification (Slack, Discord, etc.) here