How this site deploys itself
A signed webhook, a 100-line Node script and rsync.
When I push to GitHub, this happens:
- GitHub sends a
POSTto/_deploy, signed with a shared secret (HMAC-SHA256). - Apache hands that one path to a small Node listener on localhost.
- The listener checks the signature in constant time. Anything unsigned gets a
401. - On a valid push it runs
git reset,npm ciandastro build, thenrsyncs the output into the web root.
If the build fails, nothing is copied, so a broken push never takes the site down.
const expected = 'sha256=' + createHmac('sha256', SECRET).update(body).digest('hex');
return timingSafeEqual(Buffer.from(header), Buffer.from(expected));