ci: auto-deploy pipeline — webhook triggers rebuild on push
Some checks are pending
Some checks are pending
This commit is contained in:
32
webhook-server.js
Normal file
32
webhook-server.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const http = require('http')
|
||||
const { execSync } = require('child_process')
|
||||
const SECRET = 'luna-deploy-2026'
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
if (req.method === 'POST' && req.url === '/deploy') {
|
||||
let body = ''
|
||||
req.on('data', chunk => body += chunk)
|
||||
req.on('end', () => {
|
||||
console.log(`[${new Date().toISOString()}] Deploy triggered`)
|
||||
try {
|
||||
const out = execSync('/home/clawd/.openclaw/workspace/luna-recipes/deploy.sh', {
|
||||
cwd: '/home/clawd/.openclaw/workspace/luna-recipes',
|
||||
timeout: 120000,
|
||||
encoding: 'utf8'
|
||||
})
|
||||
console.log(out)
|
||||
res.writeHead(200)
|
||||
res.end('✅ Deployed\n')
|
||||
} catch (e) {
|
||||
console.error('Deploy failed:', e.message)
|
||||
res.writeHead(500)
|
||||
res.end('❌ Deploy failed\n')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
res.writeHead(404)
|
||||
res.end()
|
||||
}
|
||||
})
|
||||
|
||||
server.listen(9876, () => console.log('🚀 Deploy webhook listening on :9876'))
|
||||
Reference in New Issue
Block a user