diff --git a/assets/webhook.php b/assets/webhook.php index b26ace2..647415b 100644 --- a/assets/webhook.php +++ b/assets/webhook.php @@ -35,5 +35,5 @@ if (json_last_error() !== JSON_ERROR_NONE) { // success, do something $repo_name = $decoded['repository']['name']; echo "launching hook script "; -echo shell_exec('bash ../webhook/webhook.sh ' . $repo_name . ' 2>&1'); +echo shell_exec('bash ../webhook/webhook.sh ' . $repo_name . ' >> ../webhook/webhook.log 2>&1'); ?> \ No newline at end of file diff --git a/assets/webhook.sh b/assets/webhook.sh index c219e8b..c72a697 100644 --- a/assets/webhook.sh +++ b/assets/webhook.sh @@ -1,12 +1,11 @@ #!/bin/bash repo_name=$1 -cd /var/www/repositories/$repo_name -git pull origin prod -tmux send-keys -t directus C-c -npm install -y -npx nuxt telemetry disable -npm run build -tmux send-keys -t front C-c -tmux send-keys -t front "cd /var/www/repositories/${repo_name} && node .output/server/index.mjs" C-m cms_dir=$(ls -d /var/www/repositories/cms*/) +tmux send-keys -t directus C-c +tmux send-keys -t front C-c +cd /var/www/repositories/$repo_name &&\ +git pull origin prod &&\ +NUXT_TELEMETRY_DISABLED=1 ; npm install -y &&\ +npm run build &&\ +tmux send-keys -t front "cd /var/www/repositories/${repo_name} && node .output/server/index.mjs" C-m tmux send-keys -t directus "cd ${cms_dir} && npx directus start" C-m \ No newline at end of file diff --git a/install.sh b/install.sh index 04de817..0db4f9c 100644 --- a/install.sh +++ b/install.sh @@ -399,6 +399,8 @@ if [[ "$answer" == "y" ]]; then cp ./assets/webhook.sh /var/www/webhook chown www-data:www-data /var/www/webhook/webhook.sh chmod u+x /var/www/webhook/webhook.sh + touch /var/www/webhook/webhook.log + chown www-data:www-data /var/www/webhook/webhook.log head -n $(($(wc -l < $caddyfile) - 2)) $caddyfile > temp_Caddyfile && mv temp_Caddyfile $caddyfile echo "handle /webhook.php {" >> $caddyfile