Skip to content

Commit 270c095

Browse files
Merge pull request #203 from Houssien-Zeineddine/docker-and-pipeline
adding migrations check
2 parents d4ff19c + a69a43c commit 270c095

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

.github/workflows/deploy.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ jobs:
9494
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/final_project_react_image:latest
9595

9696
Copy-docker-compose-to-EC2:
97-
needs: test
97+
needs:
98+
[
99+
build-and-push-react-image,
100+
build-and-push-laravel-image,
101+
Copy-docker-compose-to-EC2,
102+
]
98103
runs-on: ubuntu-latest
99104

100105
steps:
@@ -122,12 +127,7 @@ jobs:
122127

123128
Deploy-Laravel-Docker:
124129
runs-on: ubuntu-latest
125-
needs:
126-
[
127-
build-and-push-react-image,
128-
build-and-push-laravel-image,
129-
Copy-docker-compose-to-EC2,
130-
]
130+
needs: Copy-docker-compose-to-EC2
131131

132132
steps:
133133
- name: Checkout repository
@@ -178,6 +178,13 @@ jobs:
178178
# Run migrations
179179
docker exec $BACKEND_CONTAINER php artisan migrate --force
180180
181+
# If fails, show error logs
182+
if [ $? -ne 0 ]; then
183+
echo "Migration failed! Showing logs:"
184+
docker logs $BACKEND_CONTAINER | grep -i error
185+
exit 1
186+
fi
187+
181188
# Clean up unused images
182189
docker image prune -a -f
183190

0 commit comments

Comments
 (0)