Skip to content

Instantly share code, notes, and snippets.

@nothke
Created December 15, 2020 15:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nothke/2a287121ba65873977f75f3d1682e98f to your computer and use it in GitHub Desktop.
Save nothke/2a287121ba65873977f75f3d1682e98f to your computer and use it in GitHub Desktop.
# A script for single [double] click uploading to itch using butler
# by Nothke
#
# Requirements:
# - Installed butler: https://itch.io/docs/butler/
# - butler added to PATH
#
# How to use:
# 1. Put this script in your project folder,
# 2. Edit the script by adding project names and ignores below
# 3. Run the script!
import os
import subprocess
import shutil
from shutil import ignore_patterns
# --------------------------------------------
# ---- Add your project's specifics here! ----
# --------------------------------------------
source = "Build" # folder relative to script
target = "nothke/webgltest" # target itch project user/game
channel = "windows" # win|windows/linux/mac|osx/android [-stable, -beta]
# Add subfolders or patterns here to ignore
ignores = [
"dontuploadthis",
"MyIL2CPPGameName_BackUpThisFolder_ButDontShipItWithYourGame"
]
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXX Code, don't touch this: XXXXXXX
script_path = os.path.dirname(os.path.realpath(__file__))
source_path = script_path + "\\" + source
if not os.path.isdir(source_path):
print("Source folder " + source_path + " doesn't exist or is not a folder")
os._exit(1)
# Copy to temporary folder to ignore certain files
#os.mkdir(script_path + "\\" + "butler_script_temp")
temp_path = script_path + "\\butler_script_temp"
shutil.copytree(source_path, temp_path,
ignore = ignore_patterns(*ignores))
#print("calling: butler push " + source_path + " " + target + ":" + channel)
# UPLOAD TO ITCH!
subprocess.call(['butler', 'push', temp_path, target + ":" + channel])
#remove the temporary folder
shutil.rmtree(temp_path)
input("Press Enter to close..")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment