13 mai 2022Deploiement automatique à l'aide de webhooksblogInstallation sudo apt install webhook Mise en place Création d'un endpoint: [ { "id": name, "execute-command": command, "command-working-directory": working directory, "pass-arguments-to-command": [ { "source": "payload", "name": "head_commit.message" }, { "source": "payload", "name": "pusher.name" }, { "source": "payload", "name": "head_commit.id" } ], "trigger-rule": { "and": [ { "match": { "type": "payload-hash-sha1", "secret": github secret, "parameter": { "source": "header", "name": "X-Hub-Signature" } } }, { "match": { "type": "value", "value": "refs/heads/main", "parameter": { "source": "payload", "name": "ref" } } } ] } } ] Création du script d'automatisation: #!/bin/sh git pull -f origin branch npm install npm run build pm2 restart appname Lancement du serveur webhook webhook -hooks hooks.json -port port server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name server_name location /hooks/ { proxy_pass http://localhost:port/hooks/; } }