Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pombredanne/1058bc3878347a416ccd7bd3876009dc to your computer and use it in GitHub Desktop.
Save pombredanne/1058bc3878347a416ccd7bd3876009dc to your computer and use it in GitHub Desktop.
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