-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_announcements.py
executable file
·36 lines (26 loc) · 1.38 KB
/
generate_announcements.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
#!/usr/bin/python
import sys
import os
from string import Template
from datetime import datetime
from subprocess import check_output
announcement_template = Template('''==========
New test build (build ${buildno}) available for Windows on sourceforge.
[url=http://sourceforge.net/projects/freeorion/files/FreeOrion/Test/FreeOrion_${buildno}_Test_Win32_Setup.exe/download]Download link for full installer.[/url]
[url=http://sourceforge.net/projects/freeorion/files/FreeOrion/Test/FreeOrion_${buildno}_Test_Win32_BinariesOnly.zip/download]Download link for zip archive with binaries only.[/url]
==========
New test build (build ${buildno}) available for macOS 10.15 and later on sourceforge.
[url=http://sourceforge.net/projects/freeorion/files/FreeOrion/Test/FreeOrion_${buildno}_Test_MacOSX_10.15.dmg/download]Download link.[/url]
==========
New test builds available for Windows and macOS (build ${buildno}):
https://sourceforge.net/projects/freeorion/files/FreeOrion/Test/
==========
''')
build_no = "XXXX"
try:
commit = check_output(["git", "show", "-s", "--format=%h", "--abbrev=7", "HEAD"]).strip()
timestamp = float(check_output(["git", "show", "-s", "--format=%ct", "HEAD"]).strip())
build_no = ".".join([datetime.utcfromtimestamp(timestamp).strftime("%Y-%m-%d"), commit])
except:
print "WARNING: Can't determine build number"
print announcement_template.substitute(buildno=build_no)