Skip to content

Instantly share code, notes, and snippets.

@jotson
Created March 12, 2020 14:11
Show Gist options
  • Save jotson/f0c011a17f1c24c5131cd2c6a1205af2 to your computer and use it in GitHub Desktop.
Save jotson/f0c011a17f1c24c5131cd2c6a1205af2 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import version
import subprocess
import os
GODOT = '/home/john/apps/godot/godot3'
BUILDDIR = '/home/john/code/games/gravity/build'
PROJECT = '/home/john/code/games/gravity/game'
OPTIONS = ['--no-window', '--resolution', '640x360'] # --no-window doesn't work on linux
# Update version.cfg with current commit
branch = version.get_branch()
print('On branch %s' % branch)
if branch != 'master':
print('*** NOT ON MASTER!')
exit()
commit = version.get_latest_commit()
print('Updating build commit in version.cfg to %s' % commit)
version.set_commit(commit)
# Increment version.cfg version number and tag git
old_version = version.get_version()
answer = input('Increment version number to %s and tag git? (y/n/yes/no, default=no) ' % str(old_version + 1))
if answer == 'y' or answer == 'yes':
version.increment_version()
new_version = version.get_version()
print('Updating version number from %d to %d' % (old_version, new_version))
print('Tagging git commit %s with v%s' % (version.get_commit(), version.get_public_version()))
version.tag_git()
else:
print('Keeping version %d' % old_version)
# Use --export-debug for a debug release
EXPORT = '--export'
builds = {
"Linux/X11": "linux64/gravity.x86_64",
"Windows Desktop 64 bit": "win64/gravity-win64.exe",
#"Windows Desktop 32 bit": "win32/gravity-win32.exe",
"Mac OSX": "osx/gravity-osx.app",
#"HTML5": "html5/index.html"
}
for platform, file in builds.items():
print("Building %s..." % platform)
command = [GODOT, '--path', PROJECT, EXPORT, platform, "%s/%s" % (BUILDDIR, file)]
command.extend(OPTIONS)
subprocess.check_output(command)
if platform == "Mac OSX":
os.rename("%s/%s" % (BUILDDIR, file), "%s/%s.zip" % (BUILDDIR, file))
print('\nAll done!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment