Skip to content

Commit 256c570

Browse files
committed
Setting up some zombie killers
1 parent e07a655 commit 256c570

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,20 @@ API_TOKEN=YOUR_GITHUB_SECRET
3131
my-site.json
3232

3333
{
34-
"path": "/home/code/my-site",
34+
"path": "/home/code/my-site", # path where repository lives
35+
"cwd": "/home/user", # user path for nvm
36+
"node": "v12.7.0", # nvm node version to use, if .nvmrc is no supplied
3537
"release": {
3638
"build": "yarn && yarn build",
37-
"deploy": "rsync -av --delete public/ /var/www/html/my-site"
39+
"deploy": "rsync -av --delete public/ /var/www/html/my-site",
40+
"cleanup": "rm -rf node_modules/ && rm -rf .cache/ && yarn cache clean"
3841
}
3942
}
4043
```
4144

4245
### Adding listener to GitHub Webhooks
4346

44-
As of `v0.1.0` - Only the `release` event is supported.
47+
As of `v0.2.0` - Only the `release` event is supported.
4548

4649
`https://{domain}/webhooks/{repo}`
4750
or

src/release.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,20 @@ def processRelease(repo, payload):
3838
subprocess.check_call(['git', 'fetch', '--all', '--tags'], cwd=data['path'])
3939
subprocess.check_call(['git', 'checkout', 'tags/' + payload['release']['tag_name']], cwd=data['path'])
4040

41-
with subprocess.Popen(' && '.join(commands), cwd=data['path'], executable='/bin/bash', shell=True) as process:
41+
with subprocess.Popen(' && '.join(commands), cwd=data['path'], executable='/bin/bash', shell=True, stdout=subprocess.PIPE) as process:
4242
try:
4343
process.communicate(timeout=300)
44+
while True:
45+
line = process.stdout.readline()
46+
if line == '' and process.poll() is not None:
47+
break
48+
if line:
49+
print(line.rstrip())
4450
except subprocess.TimeoutExpired:
4551
print('Process was killed by timeout: 300 seconds.')
4652
raise
4753
finally:
48-
if process.poll() is None:
49-
process.kill()
50-
process.communicate()
54+
process.kill()
55+
process.communicate()
5156

5257
return

0 commit comments

Comments
 (0)