Skip to content

Commit 5aef156

Browse files
committed
add migration
1 parent 0594a3a commit 5aef156

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/build-push-deploy.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ on:
3535
description: "The platforms to build with docker bake."
3636
type: string
3737
required: false
38+
migrate-command:
39+
description: "The command to run migrations."
40+
type: string
41+
required: false
42+
3843

3944

4045
jobs:
@@ -83,14 +88,27 @@ jobs:
8388
with:
8489
module-name: ${{ inputs.service-name }}
8590
build-for-environment: ${{ inputs.stage-name }}
91+
image-ref: ${{ inputs.docker-image-ref }}
8692
extra-build-args: "-f ${{ matrix.dockerfile }}"
8793

8894

95+
migrate:
96+
runs-on: mdb-dev
97+
container: ${{ secrets.ECR_REGISTRY }}/${{ inputs.service-name }}:${{ inputs.stage-name }}-${{ inputs.docker-image-ref }}
98+
needs: [get-deploy-labels, build]
99+
if: ${{ needs.get-deploy-labels.outputs.deploy-envs != '[]' }}
100+
steps:
101+
- name: Run migrations
102+
if: ${{ inputs.migrate-command }}
103+
run: |
104+
${{ inputs.migrate-command }}
105+
106+
89107
# Deploy the built image to the specified environments
90108
# Deploys to all environments at once
91109
deploy:
92110
runs-on: mdb-dev
93-
needs: [ get-deploy-labels, build ]
111+
needs: [ get-deploy-labels, build, migrate ]
94112
strategy:
95113
matrix:
96114
deploy-env: ${{fromJson(needs.get-deploy-labels.outputs.deploy-envs)}}

0 commit comments

Comments
 (0)