Update production pipeline
This commit is contained in:
41
.github/workflows/prod-pipeline.yml
vendored
41
.github/workflows/prod-pipeline.yml
vendored
@@ -5,8 +5,33 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
check-migrations:
|
||||||
|
name: Check for new Prisma migrations
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
has_new_migrations: ${{ steps.diff.outputs.has_new_migrations }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # get full history so git diff works properly
|
||||||
|
|
||||||
|
- name: Detect new migration files
|
||||||
|
id: diff
|
||||||
|
run: |
|
||||||
|
# Compare the last two commits on main
|
||||||
|
if git diff --quiet HEAD~1 -- prisma/migrations/; then
|
||||||
|
echo "✅ No new Prisma migrations detected."
|
||||||
|
echo "has_new_migrations=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "⚠️ New Prisma migrations detected! Blocking deployment."
|
||||||
|
echo "has_new_migrations=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy to production
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: check-migrations
|
||||||
|
if: needs.check-migrations.outputs.has_new_migrations == 'false'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install Bun
|
- name: Install Bun
|
||||||
@@ -28,4 +53,16 @@ jobs:
|
|||||||
git clean -f -d
|
git clean -f -d
|
||||||
git pull origin main
|
git pull origin main
|
||||||
git status
|
git status
|
||||||
make prod
|
make prod
|
||||||
|
|
||||||
|
block-deploy:
|
||||||
|
name: Block deployment (new migrations detected)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: check-migrations
|
||||||
|
if: needs.check-migrations.outputs.has_new_migrations == 'true'
|
||||||
|
steps:
|
||||||
|
- name: Stop deploy
|
||||||
|
run: |
|
||||||
|
echo "🚫 Deployment blocked because new Prisma migrations were detected."
|
||||||
|
echo "Please apply migrations on staging and verify before deploying to production."
|
||||||
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user