Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upload release assets to Github from the command line
"""Upload release assets to a GitHub release
First create a release on Github, then:
python upload_release_assets.py 1.2.0 my_data.tgz
"""
import sys
REPOSITORY="your_organization/your_repo"
with open("GITHUB_TOKEN") as f:
TOKEN=f.read().strip()
from github import Github
g = Github(TOKEN)
repo = g.get_repo(REPOSITORY)
release = repo.get_release(sys.argv[1])
release.upload_asset(sys.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment