From 594e35f481430aaa29dcdf77a587c6e0da63b022 Mon Sep 17 00:00:00 2001 From: UserA Date: Tue, 13 Aug 2024 05:09:09 +0300 Subject: [PATCH] Simple redeploy webhook pipeline --- .gitignore | 3 +++ fetch.sh | 3 +++ hooks.json | 7 +++++++ redeploy.sh | 6 ++++++ run.sh | 1 + 5 files changed, 20 insertions(+) create mode 100644 .gitignore create mode 100755 fetch.sh create mode 100644 hooks.json create mode 100644 redeploy.sh create mode 100755 run.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b989e0f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +webhook +**.tar.gz +webhook-*-*/ diff --git a/fetch.sh b/fetch.sh new file mode 100755 index 0000000..ca18167 --- /dev/null +++ b/fetch.sh @@ -0,0 +1,3 @@ +wget https://github.com/adnanh/webhook/releases/download/2.8.1/webhook-linux-amd64.tar.gz +tar xvf webhook-linux-amd64.tar.gz +cp webhook-linux-amd64/webhook . diff --git a/hooks.json b/hooks.json new file mode 100644 index 0000000..5e32d83 --- /dev/null +++ b/hooks.json @@ -0,0 +1,7 @@ +[ + { + "id": "redeploy-webhook", + "execute-command": "./redeploy.sh", + "command-working-directory": "." + } +] diff --git a/redeploy.sh b/redeploy.sh new file mode 100644 index 0000000..53b6431 --- /dev/null +++ b/redeploy.sh @@ -0,0 +1,6 @@ +cd ~/gits +for d in */; do + cd "$d" + git pull + docker compose restart +done diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..8bc030c --- /dev/null +++ b/run.sh @@ -0,0 +1 @@ +./webhook -hooks hooks.json -verbose