跳转到主要内容

一个用于可靠创建GitHub发布和上传资产的工具。使用https://github.com/google/github-release-retry/pull/6的补丁的临时分支。

项目描述

github-release-retry

License

github-release-retry2 是一个用于创建GitHub发布和可靠上传资产的工具。它与其他工具不同,因为它通过验证资产是否存在来可靠地上传资产,如果不存在则重试(删除部分资产)。

这不是一个官方支持的产品。这是一个从原始github-release-retry分支出来的,用于在scancode-toolkit发布脚本中使用的带有高级补丁的分支。

安装

需要Python 3.6+。

为了确保您使用与您首选Python 3.6+二进制文件关联的pip模块

python3 -m pip install --user github-release-retry
# where `python3` is your preferred Python 3.6+ binary.
# Omit `--user` to install for all users.

或者直接

pip3 install --user github-release-retry
# where `pip3` is your version of pip for Python 3.6+.
# Omit `--user` to install for all users.

用法

如果您的 Python用户脚本目录 不在您的 PATH 中,您可以使用

python3 -m github_release_retry.github_release_retry
# where `python3` is your preferred Python 3.6+ binary.

否则

$ github-release-retry -h
usage: github-release-retry [-h] --user USER --repo REPO --tag_name TAG_NAME
                            [--target_commitish TARGET_COMMITISH]
                            [--release_name RELEASE_NAME]
                            (--body_string BODY_STRING | --body_file BODY_FILE)
                            [--draft] [--prerelease]
                            [--github_api_url GITHUB_API_URL]
                            [--retry_limit RETRY_LIMIT]
                            [files [files ...]]

Creates a GitHub release (if it does not already exist) and uploads files to the release.
Please set the GITHUB_TOKEN environment variable.
EXAMPLE:
github-release-retry \
  --user paul \
  --repo hello-world \
  --tag_name v1.0 \
  --target_commitish 448301eb \
  --body_string "My first release." \
  hello-world.zip RELEASE_NOTES.txt

positional arguments:
  files                 The files to upload to the release. (default: None)

optional arguments:
  -h, --help            show this help message and exit
  --user USER           Required: The GitHub username or organization name in
                        which the repo resides. (default: None)
  --repo REPO           Required: The GitHub repo name in which to make the
                        release. (default: None)
  --tag_name TAG_NAME   Required: The name of the tag to create or use.
                        (default: None)
  --target_commitish TARGET_COMMITISH
                        The commit-ish value where the tag will be created.
                        Unused if the tag already exists. (default: None)
  --release_name RELEASE_NAME
                        The name of the release. Leave unset to use the
                        tag_name (recommended). (default: None)
  --body_string BODY_STRING
                        Required (or use --body_file): Text describing the
                        release. Ignored if the release already exists.
                        (default: None)
  --body_file BODY_FILE
                        Required (or use --body_string): Text describing the
                        release, which will be read from BODY_FILE. Ignored if
                        the release already exists. (default: None)
  --draft               Creates a draft release, which means it is
                        unpublished. (default: False)
  --prerelease          Creates a prerelease release, which means it will be
                        marked as such. (default: False)
  --github_api_url GITHUB_API_URL
                        The GitHub API URL without a trailing slash. (default:
                        https://api.github.com)
  --retry_limit RETRY_LIMIT
                        The number of times to retry creating/getting the
                        release and/or uploading each file. (default: 10)

开发

可选:如果您刚刚执行了 git pull 并且 Pipfile.lock 已更新,您可以删除 .venv/ 以从头开始创建虚拟环境。

在Windows上,您可以使用Git Bash shell,或者将命令(包括dev_shell.sh.template内的命令)适配到Windows命令提示符。

克隆此仓库并切换到包含此README文件的目录。执行./dev_shell.sh.template。如果默认设置不工作,请复制名为dev_shell.sh的文件并按照执行前的注释进行修改。pip必须安装您希望使用的Python版本。请注意,您可以通过例如export PYTHON=python3首先设置您的首选Python二进制文件。我们目前针对Python 3.6+。

Python 3.6在某些Debian发行版上可能损坏Pip。您可以使用发行版提供的较新版本的Python 3.7+。或者,如果您想使用Python 3.6,请参阅下文中的“安装Python”。

脚本将生成一个包含所有依赖项的Python虚拟环境(位于.venv/),然后通过以下方式激活Python虚拟环境:

  • source .venv/bin/activate(在Linux上)
  • source .venv/Scripts/activate(在Git Bash shell的Windows上)
  • .venv/Scripts/activate.bat(在cmd的Windows上)

预提交检查

  • 执行./check_all.sh来运行各种预提交检查、linters等。
  • 执行./fix_all.sh来自动修复某些问题,例如格式化。

PyCharm

使用PyCharm打开包含此README文件的目录。它应该会自动为代码以及当您打开TerminalPython Console标签时选择Python虚拟环境(位于.venv/)。

安装和配置插件

  • 文件监视器(可能已安装)
    • 监视任务应已在版本控制之下。
  • Mypy:PyCharm内置的PyCharm类型检查在幕后使用Mypy,但此插件通过使用最新版本并允许使用更严格的设置来增强它,以匹配./check_all.sh脚本使用的设置。

whitelist.dic作为自定义词典添加(在操作中搜索“拼写”)。不要通过PyCharm的“快速修复”功能添加单词,因为单词只会添加到您的个人词典中。相反,手动将单词添加到whitelist.dic

编码约定

终端

PyCharm中的Terminal标签很有用,并且将使用项目中的Python虚拟环境。

安装Python

要手动在Linux发行版上安装Python,您可以使用pyenv

https://github.com/pyenv/pyenv#basic-github-checkout

总结

  • 在此处安装推荐的所需软件包:这里

  • 然后

git clone https://github.com/pyenv/pyenv.git ~/.pyenv

# Add the following two lines to your ~/.bashrc file.
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"

# In a new terminal:
eval "$(pyenv init -)"
pyenv install 3.6.9
pyenv global 3.6.9

# Now execute the development shell script, as usual.
export PYTHON="python"
./dev_shell.sh.template

您可以在以后使用source .venv/bin/activate重新激活虚拟环境,而无需重新执行上述pyenv命令。

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装软件包的信息。

源分布

github-release-retry2-1.1.0.tar.gz (10.5 kB 查看哈希值

上传时间:

构建分布

github_release_retry2-1.1.0-py3-none-any.whl (15.9 kB 查看哈希值)

上传时间 Python 3

支持