tools for exporting godot projects via Github Actions
Diffstat (limited to '.github/actions/get-export-name/get-export-name.py')
| -rwxr-xr-x | .github/actions/get-export-name/get-export-name.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/.github/actions/get-export-name/get-export-name.py b/.github/actions/get-export-name/get-export-name.py new file mode 100755 index 0000000..7fcbd77 --- /dev/null +++ b/.github/actions/get-export-name/get-export-name.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +import re +import sys + +map = { + 3: { + "android": "Android", + "linux": "Linux/X11", + "mac": "Mac OSX", + "web": "HTML5", + "windows": "Windows Desktop", + }, + 4: { + "android": "Android", + "linux": "Linux/X11", + "mac": "macOS", + "web": "Web", + "windows": "Windows Desktop", + } +} + +platform = f'{map[int(sys.argv[1])][sys.argv[2]]}' + +with open('export_presets.cfg', "r") as f: + export_presets = f.read() + regex = r'\[preset.[0-9]+\]\n+name="(.+)"\n+platform="%s"' % platform + matches = re.search( + regex, export_presets) + if matches: + print(matches.groups()[0]) + else: + sys.exit(1) |