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