Skip to content

Revise README to highlight sync_and_build.sh upgrade #12

Revise README to highlight sync_and_build.sh upgrade

Revise README to highlight sync_and_build.sh upgrade #12

Workflow file for this run

name: Deploy
on:
push:
branches: [ main, master ]
release:
types: [ published ]
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'staging'
type: choice
options:
- staging
- production
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
name: Build and Push Docker Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
coordinator-image: ${{ steps.meta-coordinator.outputs.tags }}
worker-image: ${{ steps.meta-worker.outputs.tags }}
cache-image: ${{ steps.meta-cache.outputs.tags }}
monitor-image: ${{ steps.meta-monitor.outputs.tags }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for coordinator
id: meta-coordinator
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-coordinator
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push coordinator image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.coordinator
push: true
tags: ${{ steps.meta-coordinator.outputs.tags }}
labels: ${{ steps.meta-coordinator.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Extract metadata for worker
id: meta-worker
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-worker
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push worker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.worker
push: true
tags: ${{ steps.meta-worker.outputs.tags }}
labels: ${{ steps.meta-worker.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Extract metadata for cache
id: meta-cache
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-cache
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push cache image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.cache
push: true
tags: ${{ steps.meta-cache.outputs.tags }}
labels: ${{ steps.meta-cache.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Extract metadata for monitor
id: meta-monitor
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-monitor
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push monitor image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.monitor
push: true
tags: ${{ steps.meta-monitor.outputs.tags }}
labels: ${{ steps.meta-monitor.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy-staging:
name: Deploy to Staging
needs: build-and-push
runs-on: ubuntu-latest
environment: staging
if: github.ref == 'refs/heads/main' || github.event.inputs.environment == 'staging'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Deploy to staging
run: |
echo "Deploying to staging environment..."
echo "Coordinator image: ${{ needs.build-and-push.outputs.coordinator-image }}"
echo "Worker image: ${{ needs.build-and-push.outputs.worker-image }}"
echo "Cache image: ${{ needs.build-and-push.outputs.cache-image }}"
echo "Monitor image: ${{ needs.build-and-push.outputs.monitor-image }}"
# Add your staging deployment commands here
# Example: kubectl apply -f k8s/staging/ or helm upgrade
deploy-production:
name: Deploy to Production
needs: [build-and-push, deploy-staging]
runs-on: ubuntu-latest
environment: production
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event.release.type == 'published' || github.event.inputs.environment == 'production'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Deploy to production
run: |
echo "Deploying to production environment..."
echo "Coordinator image: ${{ needs.build-and-push.outputs.coordinator-image }}"
echo "Worker image: ${{ needs.build-and-push.outputs.worker-image }}"
echo "Cache image: ${{ needs.build-and-push.outputs.cache-image }}"
echo "Monitor image: ${{ needs.build-and-push.outputs.monitor-image }}"
# Add your production deployment commands here
# Example: kubectl apply -f k8s/production/ or helm upgrade
smoke-tests:
name: Smoke Tests
needs: deploy-production
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.event.release.type == 'published'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run smoke tests
run: |
echo "Running smoke tests against production deployment..."
# Add smoke test commands here
# Example: curl -f https://your-app.com/health or npm test -- --grep smoke