Skip to content

Instantly share code, notes, and snippets.

@zonca
Created August 22, 2019 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zonca/52857f2425942725fb74595c4f8600e9 to your computer and use it in GitHub Desktop.
Save zonca/52857f2425942725fb74595c4f8600e9 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