From 28da7eacfeb8ea0a63cab05967c7140a8ef38382 Mon Sep 17 00:00:00 2001 From: Aayush Date: Mon, 24 Apr 2023 13:14:27 +0545 Subject: [PATCH 01/23] debian updated --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e8965c0..783f3f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:9.7-slim +FROM debian:stable-slim LABEL "com.github.actions.name"="GitHub Action for WP Engine Git Deployment" LABEL "com.github.actions.description"="An action to deploy your repository to a WP Engine site via git." From c4a8dc2463697bd7c88ed04504e252c128d8a12f Mon Sep 17 00:00:00 2001 From: Aayush Date: Mon, 24 Apr 2023 13:43:13 +0545 Subject: [PATCH 02/23] checking --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 783f3f8..910ac5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ LABEL "com.github.actions.color"="blue" LABEL "repository"="http://github.com/jovrtn/github-action-wpengine-git-deploy" LABEL "maintainer"="Jesse L.K. Overton " +RUN ls -lah RUN apt-get update && apt-get install -y git ADD entrypoint.sh /entrypoint.sh From 2fba4e559e5029b07283d8dc726a09e5245810b6 Mon Sep 17 00:00:00 2001 From: Kuber Karki <105266439+kuberoutsidetech@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:43:38 +0545 Subject: [PATCH 03/23] Update entrypoint.sh --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 0a493e8..7b03a28 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,6 +28,7 @@ chmod 644 "$KNOWN_HOSTS_PATH" chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" +git init git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master From 4b5adf8f50cc2ab7a558506c6748f42c8f8ef845 Mon Sep 17 00:00:00 2001 From: Kuber Karki <105266439+kuberoutsidetech@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:47:13 +0545 Subject: [PATCH 04/23] Update entrypoint.sh --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7b03a28..d19a536 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,7 +28,7 @@ chmod 644 "$KNOWN_HOSTS_PATH" chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" -git init +echo pwd git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master From 416341be26b01b96ce38debf90c96f0970854c48 Mon Sep 17 00:00:00 2001 From: Kuber Karki <105266439+kuberoutsidetech@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:50:25 +0545 Subject: [PATCH 05/23] Update entrypoint.sh --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index d19a536..1394e63 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,7 +28,7 @@ chmod 644 "$KNOWN_HOSTS_PATH" chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" -echo pwd +pwd git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master From 71e49b7570077592f5e06494cd184e026fee9966 Mon Sep 17 00:00:00 2001 From: Kuber Karki <105266439+kuberoutsidetech@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:59:53 +0545 Subject: [PATCH 06/23] Update entrypoint.sh --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 1394e63..c6ac9e3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -29,6 +29,7 @@ chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" pwd +cd ../../ git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master From f173a51fcf5b721593ac16db57a18100ef82afa6 Mon Sep 17 00:00:00 2001 From: Kuber Karki <105266439+kuberoutsidetech@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:04:19 +0545 Subject: [PATCH 07/23] Update entrypoint.sh --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index c6ac9e3..c905f92 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,6 +30,7 @@ chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" pwd cd ../../ +git init git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master From 5ff398953b4a846bc9e9f57fb9bffafe37d5486a Mon Sep 17 00:00:00 2001 From: Kuber Karki <105266439+kuberoutsidetech@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:21:27 +0545 Subject: [PATCH 08/23] Update entrypoint.sh --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index c905f92..7b79ec0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -29,8 +29,8 @@ chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" pwd -cd ../../ -git init +cd /home/runner/work/Mauj.me/Mauj.me +pwd git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master From ad48953ef5d0937dea701c3687eaba1f8de0a0f6 Mon Sep 17 00:00:00 2001 From: Kuber Karki <105266439+kuberoutsidetech@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:28:24 +0545 Subject: [PATCH 09/23] Update entrypoint.sh --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7b79ec0..2a3b785 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -29,7 +29,7 @@ chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" pwd -cd /home/runner/work/Mauj.me/Mauj.me +cd /home/runner/work/Mauj.me/Mauj.me/ pwd git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git From a19dae49c904ca6acbfb93430ffe485129b2a6c4 Mon Sep 17 00:00:00 2001 From: Kuber Karki <105266439+kuberoutsidetech@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:36:15 +0545 Subject: [PATCH 10/23] Update entrypoint.sh --- entrypoint.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2a3b785..188fbd8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/sh -l -set -e +set -ex : ${WPENGINE_ENVIRONMENT_NAME?Required environment name variable not set.} : ${WPENGINE_SSH_KEY_PRIVATE?Required secret not set.} @@ -28,8 +28,6 @@ chmod 644 "$KNOWN_HOSTS_PATH" chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" -pwd -cd /home/runner/work/Mauj.me/Mauj.me/ pwd git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git From 4ec54f258c2c98a4ef8f2e215adc56a875f89640 Mon Sep 17 00:00:00 2001 From: Kuber Karki <105266439+kuberoutsidetech@users.noreply.github.com> Date: Mon, 24 Apr 2023 16:07:13 +0545 Subject: [PATCH 11/23] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 910ac5a..b0177ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stable-slim +FROM debian:buster-slim LABEL "com.github.actions.name"="GitHub Action for WP Engine Git Deployment" LABEL "com.github.actions.description"="An action to deploy your repository to a WP Engine site via git." From 196d0fadfc89a9a72e5cd1072c2598517e22aef6 Mon Sep 17 00:00:00 2001 From: Aayush Date: Mon, 24 Apr 2023 22:29:22 +0545 Subject: [PATCH 12/23] Update entrypoint.sh --- entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 188fbd8..3782c76 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,7 +28,9 @@ chmod 644 "$KNOWN_HOSTS_PATH" chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" -pwd +git config --global --add safe.directory /github/workspace git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master +rm -r "${SSH_PATH}" +git remote rm $WPENGINE_ENV From 0f8cada16ede22984585201d54d7757dd6b5d0fb Mon Sep 17 00:00:00 2001 From: Aayush Date: Mon, 24 Apr 2023 22:30:23 +0545 Subject: [PATCH 13/23] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b0177ed..910ac5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:buster-slim +FROM debian:stable-slim LABEL "com.github.actions.name"="GitHub Action for WP Engine Git Deployment" LABEL "com.github.actions.description"="An action to deploy your repository to a WP Engine site via git." From 01c1b9bd5474cb7f7f068b959b81a6a508e65644 Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 09:51:02 +0545 Subject: [PATCH 14/23] added post entry as option --- entrypoint.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 3782c76..f5efac7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -32,5 +32,23 @@ git config --global --add safe.directory /github/workspace git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master + +WPENGINE_SSH_USER=${WPENGINE_SSH_USER:-$WPENGINE_ENVIRONMENT_NAME} +WPENGINE_SSH_HOST=${WPENGINE_SSH_HOST:-"$WPENGINE_ENVIRONMENT_NAME.ssh.wpengine.net"} +SCRIPT_URL="/home/wpe-user/sites/$WPENGINE_ENVIRONMENT_NAME/post-deploy.sh" +# ---- 2) RUN POST-DEPLOY SCRIPT ON WP ENGINE (SSH GATEWAY) ---- +if [ -n "$ENABLE_POST_DEPLOY_SCRIPT" ]; then + echo "Running post-deploy script: $ENABLE_POST_DEPLOY_SCRIPT" + + ssh \ + -i "$WPENGINE_SSH_KEY_PRIVATE_PATH" \ + -o UserKnownHostsFile="$KNOWN_HOSTS_PATH" \ + "$WPENGINE_SSH_USER@$WPENGINE_SSH_HOST" \ + "if [ -x \"$ENABLE_POST_DEPLOY_SCRIPT\" ]; then bash \"$SCRIPT_URL\"; else echo \"Post-deploy script not found or not executable: $ENABLE_POST_DEPLOY_SCRIPT\"; fi" +else + echo "ENABLE_POST_DEPLOY_SCRIPT not set. Skipping post-deploy script." +fi + +#cleanup rm -r "${SSH_PATH}" git remote rm $WPENGINE_ENV From 52a80a92082994109b75d67c97f3af83db667a5d Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 10:03:54 +0545 Subject: [PATCH 15/23] small fixes on host --- entrypoint.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f5efac7..d9f175f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -33,17 +33,18 @@ git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHo git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master -WPENGINE_SSH_USER=${WPENGINE_SSH_USER:-$WPENGINE_ENVIRONMENT_NAME} -WPENGINE_SSH_HOST=${WPENGINE_SSH_HOST:-"$WPENGINE_ENVIRONMENT_NAME.ssh.wpengine.net"} +# WPENGINE_SSH_USER=${WPENGINE_SSH_USER:-$WPENGINE_ENVIRONMENT_NAME} +# WPENGINE_SSH_HOST=${WPENGINE_SSH_HOST:-"$WPENGINE_ENVIRONMENT_NAME.ssh.wpengine.net"} SCRIPT_URL="/home/wpe-user/sites/$WPENGINE_ENVIRONMENT_NAME/post-deploy.sh" # ---- 2) RUN POST-DEPLOY SCRIPT ON WP ENGINE (SSH GATEWAY) ---- if [ -n "$ENABLE_POST_DEPLOY_SCRIPT" ]; then echo "Running post-deploy script: $ENABLE_POST_DEPLOY_SCRIPT" + ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH ssh \ -i "$WPENGINE_SSH_KEY_PRIVATE_PATH" \ -o UserKnownHostsFile="$KNOWN_HOSTS_PATH" \ - "$WPENGINE_SSH_USER@$WPENGINE_SSH_HOST" \ + "$WPENGINE_ENVIRONMENT_NAME@$WPENGINE_ENVIRONMENT_NAME.ssh.wpengine.net" \ "if [ -x \"$ENABLE_POST_DEPLOY_SCRIPT\" ]; then bash \"$SCRIPT_URL\"; else echo \"Post-deploy script not found or not executable: $ENABLE_POST_DEPLOY_SCRIPT\"; fi" else echo "ENABLE_POST_DEPLOY_SCRIPT not set. Skipping post-deploy script." From 582745d7bda8045a62c4dc24fd42ac308848afb3 Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 10:16:23 +0545 Subject: [PATCH 16/23] removed unwanted --- entrypoint.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index d9f175f..9823ea5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -39,8 +39,6 @@ SCRIPT_URL="/home/wpe-user/sites/$WPENGINE_ENVIRONMENT_NAME/post-deploy.sh" # ---- 2) RUN POST-DEPLOY SCRIPT ON WP ENGINE (SSH GATEWAY) ---- if [ -n "$ENABLE_POST_DEPLOY_SCRIPT" ]; then echo "Running post-deploy script: $ENABLE_POST_DEPLOY_SCRIPT" - - ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH ssh \ -i "$WPENGINE_SSH_KEY_PRIVATE_PATH" \ -o UserKnownHostsFile="$KNOWN_HOSTS_PATH" \ From 5698823c67ab863be8f30e5621953408c6a74c07 Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 15:43:27 +0545 Subject: [PATCH 17/23] updated remote connection --- entrypoint.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9823ea5..fc8edc7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -33,20 +33,25 @@ git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHo git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master -# WPENGINE_SSH_USER=${WPENGINE_SSH_USER:-$WPENGINE_ENVIRONMENT_NAME} -# WPENGINE_SSH_HOST=${WPENGINE_SSH_HOST:-"$WPENGINE_ENVIRONMENT_NAME.ssh.wpengine.net"} -SCRIPT_URL="/home/wpe-user/sites/$WPENGINE_ENVIRONMENT_NAME/post-deploy.sh" -# ---- 2) RUN POST-DEPLOY SCRIPT ON WP ENGINE (SSH GATEWAY) ---- -if [ -n "$ENABLE_POST_DEPLOY_SCRIPT" ]; then - echo "Running post-deploy script: $ENABLE_POST_DEPLOY_SCRIPT" - ssh \ - -i "$WPENGINE_SSH_KEY_PRIVATE_PATH" \ + +#post deploy start +REMOTE_HOST="$WPENGINE_ENVIRONMENT_NAME.ssh.wpengine.net" +REMOTE_USER="$WPENGINE_ENVIRONMENT_NAME" +REMOTE_SCRIPT_PATH="/home/wpe-user/sites/$WPENGINE_ENVIRONMENT_NAME/post-deploy.sh" +SSH_KEY="$WPENGINE_SSH_KEY_PRIVATE_PATH" + +# 1) Add WP Engine host to known_hosts (prevent “Host key verification failed”) +ssh-keyscan -H "$REMOTE_HOST" >> "$KNOWN_HOSTS_PATH" + +# 2) Execute remote script +ssh \ + -i "$SSH_KEY" \ + -o IdentitiesOnly=yes \ -o UserKnownHostsFile="$KNOWN_HOSTS_PATH" \ - "$WPENGINE_ENVIRONMENT_NAME@$WPENGINE_ENVIRONMENT_NAME.ssh.wpengine.net" \ - "if [ -x \"$ENABLE_POST_DEPLOY_SCRIPT\" ]; then bash \"$SCRIPT_URL\"; else echo \"Post-deploy script not found or not executable: $ENABLE_POST_DEPLOY_SCRIPT\"; fi" -else - echo "ENABLE_POST_DEPLOY_SCRIPT not set. Skipping post-deploy script." -fi + "$REMOTE_USER@$REMOTE_HOST" \ + "bash $REMOTE_SCRIPT_PATH" + + #cleanup rm -r "${SSH_PATH}" From 1034971072162c92aa9f6d09f6e7b02edf9b4c05 Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 16:00:49 +0545 Subject: [PATCH 18/23] updated remote connection --- entrypoint.sh | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index fc8edc7..35bbab0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -33,23 +33,27 @@ git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHo git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git git push -fu $WPENGINE_ENV $BRANCH:master - -#post deploy start -REMOTE_HOST="$WPENGINE_ENVIRONMENT_NAME.ssh.wpengine.net" -REMOTE_USER="$WPENGINE_ENVIRONMENT_NAME" -REMOTE_SCRIPT_PATH="/home/wpe-user/sites/$WPENGINE_ENVIRONMENT_NAME/post-deploy.sh" -SSH_KEY="$WPENGINE_SSH_KEY_PRIVATE_PATH" - -# 1) Add WP Engine host to known_hosts (prevent “Host key verification failed”) -ssh-keyscan -H "$REMOTE_HOST" >> "$KNOWN_HOSTS_PATH" - -# 2) Execute remote script -ssh \ - -i "$SSH_KEY" \ - -o IdentitiesOnly=yes \ - -o UserKnownHostsFile="$KNOWN_HOSTS_PATH" \ - "$REMOTE_USER@$REMOTE_HOST" \ - "bash $REMOTE_SCRIPT_PATH" +if [ "$ENABLE_POST_DEPLOY_SCRIPT" = "true" ]; then + # Commands to execute if the condition is true + #post deploy start + REMOTE_HOST="wakemanagendev.ssh.wpengine.net" + REMOTE_USER="wakemanagendev" + REMOTE_SCRIPT_PATH="/home/wpe-user/sites/wakemanagendev/post-deploy.sh" + + # 1) Add WP Engine host to known_hosts (prevent “Host key verification failed”) + ssh-keyscan -H "$REMOTE_HOST" >> "$KNOWN_HOSTS_PATH" + + # 2) Execute remote script + ssh \ + -i "$WPENGINE_SSH_KEY_PRIVATE_PATH" \ + -o IdentitiesOnly=yes \ + -o UserKnownHostsFile="$KNOWN_HOSTS_PATH" \ + "$REMOTE_USER@$REMOTE_HOST" \ + "bash $REMOTE_SCRIPT_PATH" +else + # Commands to execute if the condition is false + echo "Post deploy script not enabled" +fi From 7a326fc1431b06294a9fecab57758c000c915aa7 Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 16:09:37 +0545 Subject: [PATCH 19/23] updated remote connection --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 35bbab0..371a974 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -42,6 +42,7 @@ if [ "$ENABLE_POST_DEPLOY_SCRIPT" = "true" ]; then # 1) Add WP Engine host to known_hosts (prevent “Host key verification failed”) ssh-keyscan -H "$REMOTE_HOST" >> "$KNOWN_HOSTS_PATH" + echo "$KNOWN_HOSTS_PATH" # 2) Execute remote script ssh \ From fe505262ff52b9d8a4309a3199692c643ad78007 Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 16:17:29 +0545 Subject: [PATCH 20/23] updated remote connection --- entrypoint.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 371a974..39685a5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -42,15 +42,20 @@ if [ "$ENABLE_POST_DEPLOY_SCRIPT" = "true" ]; then # 1) Add WP Engine host to known_hosts (prevent “Host key verification failed”) ssh-keyscan -H "$REMOTE_HOST" >> "$KNOWN_HOSTS_PATH" - echo "$KNOWN_HOSTS_PATH" + echo "=== KNOWN HOSTS CONTENT ===" + cat "$KNOWN_HOSTS_PATH" + echo "=== KNOWN HOSTS CONTENT END===" + echo "=== WPENGINE_SSH_KEY_PRIVATE_PATH ===" + cat "$WPENGINE_SSH_KEY_PRIVATE_PATH" + echo "=== WPENGINE_SSH_KEY_PRIVATE_PATH END===" # 2) Execute remote script ssh \ -i "$WPENGINE_SSH_KEY_PRIVATE_PATH" \ -o IdentitiesOnly=yes \ -o UserKnownHostsFile="$KNOWN_HOSTS_PATH" \ - "$REMOTE_USER@$REMOTE_HOST" \ - "bash $REMOTE_SCRIPT_PATH" + wakemanagendev@wakemanagendev.ssh.wpengine.net \ + "bash /home/wpe-user/sites/wakemanagendev/post-deploy.sh" else # Commands to execute if the condition is false echo "Post deploy script not enabled" From 6255182586019f2fe424a303ab98098fe4cdaf01 Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 16:23:48 +0545 Subject: [PATCH 21/23] updated remote connection --- entrypoint.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 39685a5..7fa0411 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -40,22 +40,16 @@ if [ "$ENABLE_POST_DEPLOY_SCRIPT" = "true" ]; then REMOTE_USER="wakemanagendev" REMOTE_SCRIPT_PATH="/home/wpe-user/sites/wakemanagendev/post-deploy.sh" + # 1) Add WP Engine host to known_hosts (prevent “Host key verification failed”) ssh-keyscan -H "$REMOTE_HOST" >> "$KNOWN_HOSTS_PATH" - echo "=== KNOWN HOSTS CONTENT ===" - cat "$KNOWN_HOSTS_PATH" - echo "=== KNOWN HOSTS CONTENT END===" - echo "=== WPENGINE_SSH_KEY_PRIVATE_PATH ===" - cat "$WPENGINE_SSH_KEY_PRIVATE_PATH" - echo "=== WPENGINE_SSH_KEY_PRIVATE_PATH END===" # 2) Execute remote script ssh \ -i "$WPENGINE_SSH_KEY_PRIVATE_PATH" \ -o IdentitiesOnly=yes \ - -o UserKnownHostsFile="$KNOWN_HOSTS_PATH" \ - wakemanagendev@wakemanagendev.ssh.wpengine.net \ - "bash /home/wpe-user/sites/wakemanagendev/post-deploy.sh" + "$REMOTE_USER@$REMOTE_HOST" \ + "bash $REMOTE_SCRIPT_PATH" else # Commands to execute if the condition is false echo "Post deploy script not enabled" From 78c1a6cefd7548859f022106af1842c9a5e8a1ef Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 16:29:26 +0545 Subject: [PATCH 22/23] updated remote connection --- entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7fa0411..aa24ad6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,10 +28,10 @@ chmod 644 "$KNOWN_HOSTS_PATH" chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" -git config --global --add safe.directory /github/workspace -git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" -git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git -git push -fu $WPENGINE_ENV $BRANCH:master +# git config --global --add safe.directory /github/workspace +# git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" +# git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git +# git push -fu $WPENGINE_ENV $BRANCH:master if [ "$ENABLE_POST_DEPLOY_SCRIPT" = "true" ]; then # Commands to execute if the condition is true From cc10b29ee445dada5234ed1de433334aa60a6231 Mon Sep 17 00:00:00 2001 From: Aayush Date: Fri, 14 Nov 2025 17:28:14 +0545 Subject: [PATCH 23/23] updated remote connection --- entrypoint.sh | 79 +++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 47 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index aa24ad6..6d6329c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,62 +1,47 @@ #!/bin/sh -l set -ex +if [ "$ENABLE_POST_DEPLOY_SCRIPT" = "true" ]; then + # Required env vars + : ${WPENGINE_ENVIRONMENT_NAME?Required environment name variable not set.} + : ${POST_DEPLOY_SSH_PRIVATE?Required secret not set.} -: ${WPENGINE_ENVIRONMENT_NAME?Required environment name variable not set.} -: ${WPENGINE_SSH_KEY_PRIVATE?Required secret not set.} -: ${WPENGINE_SSH_KEY_PUBLIC?Required secret not set.} - -SSH_PATH="$HOME/.ssh" -WPENGINE_HOST="git.wpengine.com" -KNOWN_HOSTS_PATH="$SSH_PATH/known_hosts" -WPENGINE_SSH_KEY_PRIVATE_PATH="$SSH_PATH/wpengine_key" -WPENGINE_SSH_KEY_PUBLIC_PATH="$SSH_PATH/wpengine_key.pub" -WPENGINE_ENVIRONMENT_DEFAULT="production" -WPENGINE_ENV=${WPENGINE_ENVIRONMENT:-$WPENGINE_ENVIRONMENT_DEFAULT} -LOCAL_BRANCH_DEFAULT="master" -BRANCH=${LOCAL_BRANCH:-$LOCAL_BRANCH_DEFAULT} - -mkdir "$SSH_PATH" + SSH_PATH="$HOME/.ssh" + KNOWN_HOSTS_PATH="$SSH_PATH/known_hosts" + WPENGINE_SSH_KEY_PRIVATE_PATH="$SSH_PATH/wpengine_key" -ssh-keyscan -t rsa "$WPENGINE_HOST" >> "$KNOWN_HOSTS_PATH" + # Derive SSH host/user + remote script path from environment name + REMOTE_HOST="${WPENGINE_ENVIRONMENT_NAME}.ssh.wpengine.net" + REMOTE_USER="${WPENGINE_ENVIRONMENT_NAME}" + REMOTE_SCRIPT_PATH="/home/wpe-user/sites/${WPENGINE_ENVIRONMENT_NAME}/post-deploy.sh" -echo "$WPENGINE_SSH_KEY_PRIVATE" > "$WPENGINE_SSH_KEY_PRIVATE_PATH" -echo "$WPENGINE_SSH_KEY_PUBLIC" > "$WPENGINE_SSH_KEY_PUBLIC_PATH" + # Create SSH dir + known_hosts + mkdir -p "$SSH_PATH" + touch "$KNOWN_HOSTS_PATH" -chmod 700 "$SSH_PATH" -chmod 644 "$KNOWN_HOSTS_PATH" -chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" -chmod 644 "$WPENGINE_SSH_KEY_PUBLIC_PATH" + chmod 700 "$SSH_PATH" + chmod 600 "$KNOWN_HOSTS_PATH" -# git config --global --add safe.directory /github/workspace -# git config core.sshCommand "ssh -i $WPENGINE_SSH_KEY_PRIVATE_PATH -o UserKnownHostsFile=$KNOWN_HOSTS_PATH" -# git remote add $WPENGINE_ENV git@$WPENGINE_HOST:$WPENGINE_ENV/$WPENGINE_ENVIRONMENT_NAME.git -# git push -fu $WPENGINE_ENV $BRANCH:master + # Save private key + echo "$POST_DEPLOY_SSH_PRIVATE" > "$WPENGINE_SSH_KEY_PRIVATE_PATH" + chmod 600 "$WPENGINE_SSH_KEY_PRIVATE_PATH" -if [ "$ENABLE_POST_DEPLOY_SCRIPT" = "true" ]; then - # Commands to execute if the condition is true - #post deploy start - REMOTE_HOST="wakemanagendev.ssh.wpengine.net" - REMOTE_USER="wakemanagendev" - REMOTE_SCRIPT_PATH="/home/wpe-user/sites/wakemanagendev/post-deploy.sh" + # Add SSH gateway host to known_hosts (all key types, hostname hashed) + ssh-keyscan -H "$REMOTE_HOST" >> "$KNOWN_HOSTS_PATH" - # 1) Add WP Engine host to known_hosts (prevent “Host key verification failed”) - ssh-keyscan -H "$REMOTE_HOST" >> "$KNOWN_HOSTS_PATH" + echo "Running post-deploy script on ${REMOTE_USER}@${REMOTE_HOST}" + echo "Remote script: ${REMOTE_SCRIPT_PATH}" - # 2) Execute remote script - ssh \ - -i "$WPENGINE_SSH_KEY_PRIVATE_PATH" \ - -o IdentitiesOnly=yes \ - "$REMOTE_USER@$REMOTE_HOST" \ - "bash $REMOTE_SCRIPT_PATH" + ssh \ + -i "$WPENGINE_SSH_KEY_PRIVATE_PATH" \ + -o IdentitiesOnly=yes \ + -o UserKnownHostsFile="$KNOWN_HOSTS_PATH" \ + "$REMOTE_USER@$REMOTE_HOST" \ + "bash $REMOTE_SCRIPT_PATH" else - # Commands to execute if the condition is false - echo "Post deploy script not enabled" + echo "Post deploy script not enabled (ENABLE_POST_DEPLOY_SCRIPT != true)" fi - - -#cleanup -rm -r "${SSH_PATH}" -git remote rm $WPENGINE_ENV +# Cleanup +rm -rf "$SSH_PATH"