Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ name: Deploy to Production
on:
workflow_dispatch:

env:
# Array of usernames allowed to trigger production deploys
ALLOWED_USERS: ${{ vars.PROD_DEPLOYMENT_ALLOWED_USERS }}

jobs:
# Sync dev branch to main before deployment
sync-dev-to-main:
runs-on: ubuntu-latest
if: ${{ contains(fromJson(env.ALLOWED_USERS), github.actor) }}
if: ${{ contains(fromJson(vars.PROD_DEPLOYMENT_ALLOWED_USERS), github.actor) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -48,7 +44,7 @@ jobs:
push-to-dockerhub:
runs-on: ubuntu-latest
needs: sync-dev-to-main
if: ${{ contains(fromJson(env.ALLOWED_USERS), github.actor) }}
if: ${{ contains(fromJson(vars.PROD_DEPLOYMENT_ALLOWED_USERS), github.actor) }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
Expand Down Expand Up @@ -89,7 +85,7 @@ jobs:
push-to-ghcr:
runs-on: ubuntu-latest
needs: sync-dev-to-main
if: ${{ contains(fromJson(env.ALLOWED_USERS), github.actor) }}
if: ${{ contains(fromJson(vars.PROD_DEPLOYMENT_ALLOWED_USERS), github.actor) }}
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -124,7 +120,7 @@ jobs:
deploy-prod-and-staging:
runs-on: ubuntu-latest
needs: [sync-dev-to-main, push-to-dockerhub, push-to-ghcr]
if: ${{ contains(fromJson(env.ALLOWED_USERS), github.actor) }}
if: ${{ contains(fromJson(vars.PROD_DEPLOYMENT_ALLOWED_USERS), github.actor) }}
env:
RENDER_DEPLOY_HOOK_URL_PROD: ${{ secrets.RENDER_DEPLOY_HOOK_URL_PROD }}
RENDER_DEPLOY_HOOK_URL_DEV: ${{ secrets.RENDER_DEPLOY_HOOK_URL_DEV }}
Expand All @@ -140,15 +136,6 @@ jobs:
exit 1
fi

- name: Deploy to Production
run: |
echo "πŸš€ Deploying to Production..."
curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK_URL_PROD }} || {
echo "❌ Production deploy failed!"
exit 1
}
echo "βœ… Production deployment completed successfully!"

- name: Deploy to Staging
run: |
echo "πŸš€ Deploying to Staging..."
Expand All @@ -158,10 +145,19 @@ jobs:
}
echo "βœ… Staging deployment completed successfully!"

- name: Deploy to Production
run: |
echo "πŸš€ Deploying to Production..."
curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK_URL_PROD }} || {
echo "❌ Production deploy failed!"
exit 1
}
echo "βœ… Production deployment completed successfully!"

- name: Deployment Summary
run: |
echo "πŸŽ‰ All deployments completed successfully!"
echo "βœ… Branch sync: dev β†’ main"
echo "βœ… Docker images: pushed to Docker Hub and GHCR"
echo "βœ… Production: deployed"
echo "βœ… Staging: deployed"
echo "βœ… Production: deployed"