Skip to content

Commit

Permalink
updated workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyAsh5114 committed Jun 17, 2024
1 parent ec0dc2a commit ed871ec
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/main-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ env:

on:
push:
paths:
- './prisma/migrations/**'
branches:
- main
- master
Expand Down Expand Up @@ -51,15 +49,26 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
needs: test
if: ${{ github.event_name == 'push' && needs.test.result == 'success' }}
if: ${{ needs.test.result == 'success' }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
- name: Install dependencies
run: npm install
- name: Check for changes in migrations
id: check_migrations
run: |
git fetch origin ${{ github.sha }}
if git diff --quiet HEAD~1 HEAD -- ./prisma/migrations; then
echo "No changes in migrations"
exit 1
else
echo "Changes detected in migrations"
fi
- name: Apply all pending migrations to the database
if: steps.check_migrations.outcome == 'success'
run: npx prisma migrate deploy
env:
DATABASE_URL: ${{ secrets.DATABASE_URL_MAIN }}

0 comments on commit ed871ec

Please sign in to comment.