Skip to content

Commit 0c1169a

Browse files
authored
Add sync-migrations step to deployment workflow
1 parent 2e58d90 commit 0c1169a

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

.github/workflows/deploy.yaml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,44 @@ jobs:
4242
docker build -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$TAG -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:latest .
4343
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY --all-tags
4444
45+
sync-migrations:
46+
name: Sync Migrations
47+
needs: test
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Check out repository
52+
uses: actions/checkout@v3
53+
54+
- name: Configure AWS credentials
55+
uses: aws-actions/configure-aws-credentials@v4
56+
with:
57+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
58+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
59+
aws-region: us-east-1
60+
61+
- name: Sync dbconfig.yml
62+
run: aws s3 sync ./dbconfig.yml s3://echo-base/${{ github.sha }}/dbconfig.yml --delete
63+
64+
- name: Sync migrations
65+
run: aws s3 sync ./migrations s3://echo-base/${{ github.sha }}/migrations --delete
66+
67+
decision-gate:
68+
name: Decision Gate
69+
needs:
70+
- build-and-push
71+
- sync-migrations
72+
runs-on: ubuntu-latest
73+
74+
steps:
75+
- name: Pass
76+
run: |
77+
echo "decision gate passed"
78+
exit 0
79+
4580
deploy:
4681
name: Deploy to EC2
47-
needs: build-and-push
82+
needs: decision-gate
4883
runs-on: ubuntu-latest
4984

5085
steps:

0 commit comments

Comments
 (0)