forked from theotherp/nzbhydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildWindowsDist.py
30 lines (23 loc) · 1.17 KB
/
buildWindowsDist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
import os
import requests
from bs4 import BeautifulSoup
from subprocess import call
from nzbhydra import update
DO_PUSH = DO_RELEASE = True
_, version = update.get_current_version()
html = update.getVersionHistory(sinceLastVersion=True)
find_all = [x.text for x in BeautifulSoup(html, "html.parser").findAll("p")]
text = '\n\n'.join(find_all)
returncode = call(["buildWindowsdist.cmd", version])
if returncode == 0 and DO_PUSH:
returncode = call(["pushWindowsdist.cmd", version])
if returncode == 0 and DO_RELEASE:
token = os.environ.get("TOKEN")
data = {"tag_name": version, "target_commitish": "master", "name": version, "body": text, "draft": False, "prerelease": False}
r = requests.post("https://api.github.com/repos/theotherp/nzbhydra-windows-releases/releases?access_token=" + token, data=json.dumps(data))
r.raise_for_status()
token = os.environ.get("TOKEN")
data = {"tag_name": version, "target_commitish": "master", "name": version, "body": text, "draft": False, "prerelease": False}
r = requests.post("https://api.github.com/repos/theotherp/nzbhydra/releases?access_token=" + token, data=json.dumps(data))
r.raise_for_status()