forked from marticliment/ElevenClock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_release.py
61 lines (48 loc) · 1.32 KB
/
generate_release.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import sys
import hashlib
from os.path import exists
sys.path.append("elevenclock")
sys.path.append("elevenclock/lang")
from versions import versionName
from lang_tools import *
# generate list of translations
readmeLangs = getMarkdownSupportLangs()
# generate checksum
sha256_hash = hashlib.sha256()
checksum = "missing"
shafiles = [
"ElevenClock.Installer.exe",
"ElevenClock.exe",
]
for filename in shafiles:
if (not exists(filename)): continue
f = open(filename, "rb")
for byte_block in iter(lambda: f.read(4096),b""):
sha256_hash.update(byte_block)
checksum = sha256_hash.hexdigest()
f.close()
break
# output
release = f"""
[![Downloads@{versionName}](https://img.shields.io/github/downloads/martinet101/ElevenClock/{versionName}/total?style=for-the-badge)](https://github.com/martinet101/ElevenClock/releases/download/{versionName}/ElevenClock.Installer.exe)
# Changelog:
*
*
*
# Available languages:
(Please note that this languages might be updated in the future by the app itself. The languages listed here are the bundled ones)
{readmeLangs}
<br><br>
SHA256: `{checksum}`
"""
# write output
f = open("RELEASE.md", "w", encoding="utf-8")
f.write(release)
f.close()
print()
print("MD result has been saved to RELEASE.md: The contents are:")
print()
print()
print(release)
print()
print()