From 29fa03a95d728e9bd655acd1a782b77cf73f432f Mon Sep 17 00:00:00 2001 From: som-matrix Date: Mon, 29 Apr 2024 19:46:37 +0530 Subject: [PATCH] feat: add step to update the docker image --- README.md | 4 ++++ entrypoint.sh | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 04f6d4e..45c9b28 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,10 @@ jobs: - name: Deploy id: deploy uses: superfly/fly-pr-review-apps@1.0.0 + + - name: Update docker image + if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }} + run: flyctl image update -a pr-${{ github.event.number }}-myapp-app --skip-health-checks -y ``` ## Cleaning up GitHub environments diff --git a/entrypoint.sh b/entrypoint.sh index 6719a6f..17c91c7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -53,6 +53,12 @@ if [ -n "$INPUT_POSTGRES" ]; then flyctl postgres attach "$INPUT_POSTGRES" --app "$app" || true fi +# Update docker image when subsequent commits are pushed to the PR. +if [ "$EVENT_TYPE" = "synchronize" ]; then + flyctl deploy $detach --config "$config" --app "$app" --region "$region" --image "$image" --strategy immediate --ha=$INPUT_HA --vm-cpu-kind "$INPUT_CPUKIND" --vm-cpus $INPUT_CPU --vm-memory "$INPUT_MEMORY" + exit 0 +fi + # Trigger the deploy of the new version. echo "Contents of config $config file: " && cat "$config" if [ -n "$INPUT_VM" ]; then