Created
December 4, 2019 09:15
-
-
Save benwrk/5c11d41fd494e9b21b56098599dc853b to your computer and use it in GitHub Desktop.
GitHub Automatic Deployment Webhook Config for `ist-fr.vistec.ist`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Location: /var/www/ist-fr.vistec.ist | |
# Redirects stdout/stderr to a file | |
exec > ./deploy.log 2>&1 | |
# Add snap bin PATH (npm is here) | |
export PATH=$PATH:/snap/bin | |
# Remove existing repo | |
rm -rf ./repo | |
# Fresh clone | |
git clone https://github.com/ist-fr/2019.git repo | |
# Go into repo | |
cd repo | |
# Install & build | |
npm ci | |
npm run build | |
# Remove existing build | |
rm -rf ../html/* | |
# Publish new build | |
rsync --archive --chown root:root ./dist/ ../html/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Location: /etc/webhook.conf | |
[ | |
{ | |
"id": "deploy-ist-fr.vistec.ist", | |
"execute-command": "/var/www/ist-fr.vistec.ist/deploy.sh", | |
"command-working-directory": "/var/www/ist-fr.vistec.ist", | |
"response-message": "Executing deploy script...", | |
"trigger-rule": | |
{ | |
"and": | |
[ | |
{ | |
"match": | |
{ | |
"type": "payload-hash-sha1", | |
"secret": "secret-key-here", | |
"parameter": | |
{ | |
"source": "header", | |
"name": "X-Hub-Signature" | |
} | |
} | |
}, | |
{ | |
"match": | |
{ | |
"type": "value", | |
"value": "refs/heads/master", | |
"parameter": | |
{ | |
"source": "payload", | |
"name": "ref" | |
} | |
} | |
} | |
] | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment