#github #projects #cargo-subcommand #publishing #release #cargo-toml #hublish

app cargo-hublish

A cargo 子命令,用于将 Rust 项目的 GitHub 发布。

3 个不稳定版本

使用旧的 Rust 2015

0.2.0 2017年5月22日
0.1.1 2017年5月19日
0.1.0 2017年5月19日

#693Cargo 插件

Apache-2.0

16KB
322

cargo-hublish

Apache 2.0 License Crates.io Crates.io

自动将您的 Rust 项目的 GitHub 发布。

安装

您可以使用以下一行命令使用 cargo 安装 cargo-hpublish:

cargo install cargo-hublish

为什么

我喜欢编写工具,特别是 CLI 工具。将这些工具发布到 GitHub 是分发项目的绝佳方式。然而创建 GitHub 发布相对繁琐,所以我决定使用 Cargo.toml 中的元数据来自动化它。

贡献

我很乐意接受您想添加的任何功能的拉取请求,我个人希望添加的一些功能包括:

  • 自动交叉编译项目,并将生成的构建结果放在发布中使用 upload_url
  • 集成测试(由于它如此依赖于 GitHub API,我不确定最好的方法是什么。如果您有想法,请告诉我!)

如果您不确定您的功能是否适合,只需在开始工作之前提交一个 GitHub 问题请求评论即可!

一如既往,遵循 Rust 行为准则,这不仅是一件好事,也是我个人对 Rust 感到如此兴奋的原因之一。

如果您添加的内容没有涵盖现有的集成测试,请务必为它编写一个测试。

请将所有拉取请求提交到 develop 分支。

从源代码构建

就像任何 Rust 项目一样,您可以使用 cargo build 简单地构建,但是我包含了一个 make 文件,它为执行某些命令提供了一些便利。特别是当运行测试时,您应该始终使用 make test,因为它将清理并重新生成用于集成测试的 cargo 项目。

用法

Publish Rust projects to Github Releases

Usage: cargo hublish [options]

Options:
	-h, --help          Show this help message.
	-n, --name NAME     Name of the release. Defaults to package name +
						version number as defined in Cargo.toml. Example:
						cargo-hublish v0.1.0
	-t, --tag TAG_NAME  Name of the git tag for the release, if not set
						defaults to version number as defined in Cargo.toml.
	-c, --commit COMMIT SHA of the commit the tag should point to, defaults to
						HEAD of master
	-f, --file FILE     A file which contains the markdown for the body
						(description) of the release
	-m, --message MESSAGE
						The body of the release (description)
	-d, --draft         Set whether this is a draft release defaults to false
	-p, --prerelease    Set whether this is a prerelease defaults to false
		--url URL       URL for the github API request. cargo-hublish attempts
						to find this based on the origin url of the git repo.
						If you're using a different remote such as 'github'
						then use the --remote flag to set that name, otherwise
						set the full api url with this flag.
	-r, --remote REMOTE Remote name to use when generating API endpoint.
						Defaults to origin.
	-u, --username USERNAME
						Your github username. If not provided you will be
						prompted.
	-p, --password PASSWORD
						Your github password. If not provided you will be
						prompted.

依赖项

~15–25MB
~429K SLoC