Git Product home page Git Product logo

github-binary-upload's Introduction

GitHub Binary Upload

Introduction

github-binary-upload is a script for creating GitHub releases from Git tags with attached assets.

Installation

  • From PyPI:

    python3 -m pip install github-binary-upload
  • Self-contained executables for Linux x86_64 with glibc >= 2.17 (any recent Linux distribution) and macOS High Sierra and newer are available on the releases page.

  • AUR package for Arch Linux users: python-github-binary-upload

Usage

After installation you can run github-binary-upload:

usage: github-binary-upload [-h] [-g GITHUB_SERVER] [-c CREDENTIALS_FILE] [-l]
                            [-n] [-u USERNAME] [-V]
                            [project] [tag] [assets [assets ...]]

github-binary-upload is a utility for publishing releases from tags with attached files on GitHub.

positional arguments:
  project               GitHub project in the format "<user>/<project name>"
  tag                   tag that will be published as a release, ignored if '
                        --latest' is given
  assets                files that will be attached to the release

optional arguments:
  -h, --help            show this help message and exit
  -g GITHUB_SERVER, --github-server GITHUB_SERVER
                        GitHub server hostname (default: github.com)
  -c CREDENTIALS_FILE, --credentials-file CREDENTIALS_FILE
                        path to a file containing username and password/access
                        token (on two separate lines, default: ~/.github-
                        binary-uploadrc)
  -l, --latest          get the latest tag from the GitHub API
  -n, --dry-run         only print which releases would be published
  -u USERNAME, --user USERNAME
                        user account for querying the GitHub API; the password
                        is read from stdin
  -V, --version         print the version number and exit

Example

Run

github-binary-upload -u ExampleUser -l ExampleUser/ExampleProject MyFirstAsset.zip MySecondAsset.whl

to create a release from the latest tag in the GitHub project ExampleUser/ExampleProject. The files MyFirstAsset.zip and MySecondAsset.whl will be attached as downloadable files.

github-binary-upload can be called multiple times on the same tag. The release will be recreated each time. This is especially useful to CI pipelines which can run more than once.

Python API

github-binary-upload defines a function publish_release_from_tag which can be called from Python code:

from github_binary_upload import publish_release_from_tag


publish_release_from_tag(
    project, tag, assets, github_server, username, password, dry_run
)

If tag is None, the latest tag will be converted to a GitHub release. dry_run is an optional parameter which defaults to False.

Contributing

Please open an issue on GitHub if you experience bugs or miss features. Please consider to send a pull request if you can spend time on fixing the issue yourself. This project uses pre-commit to ensure code quality and a consistent code style. Run

make git-hooks-install

to install all linters as Git hooks in your local clone of github-binary-upload.

github-binary-upload's People

Contributors

ingomeyer441 avatar k9ert avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

k9ert

github-binary-upload's Issues

Can not import github_binary_upload

I can not import the module gives me error file not found. I dont know why this error is showing up.
`

Traceback (most recent call last):

File "c:\Users\Farhan Ahmed\Desktop\code\f1\main.py", line 1, in
from github_binary_upload import publish_release_from_tag
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\site-packages\github_binary_upload.py", line 18, in
from yacl import setup_colored_stderr_logging
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\site-packages\yacl.py", line 271, in
class ColoredFormatter(logging.Formatter):
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\site-packages\yacl.py", line 273, in ColoredFormatter
"funcName": TerminalColorCodes.blue,
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\site-packages\yacl.py", line 160, in blue
cls._init_terminal_codes()
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\site-packages\yacl.py", line 107, in _init_terminal_codes
has_terminal_color = cls.has_terminal_color()
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\site-packages\yacl.py", line 129, in has_terminal_color
or (is_stderr_tty() and int(cls._query_terminfo_database("colors")) >= 8)
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\site-packages\yacl.py", line 123, in _query_terminfo_database
return str(subprocess.check_output(["tput"] + capname.split(), universal_newlines=True))
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Farhan Ahmed\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
`
image

FileNotFoundError: The file "C" does not exist or is not a regular file.

it is giving error file not found although I gave full path to the file.zip. I am new and could not find a single example on how to use this so I have been facing many errors too.
`
from github_binary_upload import publish_release_from_tag

project = "slarti-com/slarti-electron-wrapper"
tag = "v1.0.2"
assets = "C:\Users\Farhan Ahmed\Desktop\code\f1"
github_server = "github.com"
username = ""
password = ""
publish_release_from_tag(
project, tag, assets, github_server, username, password
)
`
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.