Set up some release automation.

Partially fixes https://github.com/graphql-rust/juniper/issues/248.

* Install `cargo-release`. (currently need a patched one with https://github.com/sunng87/cargo-release/pull/74)
* Run `cargo make release-dry-run` to do a dry run of a release
* Run `cargo make release` to do a minor versioned release of every crate
* Run `cargo make release-patch` to do a patch release of every crate

To only release one crate:
* Change directories into the desired crate
* Point `cargo-make` to the workspace-level Makefile when running a command. For example, `cargo make --makefile ../Makefile.toml release-dry-run`.

From the workspace root, run `cargo
This commit is contained in:
Christian Legnitto 2018-12-17 13:40:11 -08:00
parent 73175d7a10
commit 2502c1b6da
8 changed files with 74 additions and 0 deletions

17
Makefile.toml Normal file
View file

@ -0,0 +1,17 @@
# https://github.com/sagiegurari/cargo-make#automatically-extend-workspace-makefile
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "true"
# Run `cargo make release` to push a new minor release of every crate.
[tasks.release]
args = ["release", "--config", "../_build/release.toml"]
# Run `cargo make release-patch` to push a new patch release of every crate.
[tasks.release-patch]
args = ["release", "--config", "../_build/release.toml", "patch"]
# Run `cargo make release-dry-run` to do a dry run.
[tasks.release-dry-run]
description = "Run `cargo-release --dry-run` for every crate"
command = "${HOME}/src/cargo-release/target/debug/cargo-release"
args = ["release", "--config", "../_build/release.toml", "--dry-run"]

5
_build/release.toml Normal file
View file

@ -0,0 +1,5 @@
dev-version-ext = "pre"
pre-release-commit-message = "Release {{crate_name}} {{version}}"
pro-release-commit-message = "Bump {{crate_name}} version to {{next_version}}"
tag-message = "Release {{crate_name}} {{version}}"
upload-doc = false

8
juniper/Makefile.toml Normal file
View file

@ -0,0 +1,8 @@
[tasks.release]
args = ["release"]
[tasks.release-patch]
args = ["release", "patch"]
[tasks.release-dry-run]
args = ["release", "--dry-run"]

13
juniper/release.toml Normal file
View file

@ -0,0 +1,13 @@
dev-version-ext = "pre"
pre-release-commit-message = "Release {{crate_name}} {{version}}"
pro-release-commit-message = "Bump {{crate_name}} version to {{next_version}}"
tag-message = "Release {{crate_name}} {{version}}"
upload-doc = false
pre-release-replacements = [
{file="../juniper_hyper/Cargo.toml", search="juniper = { version = \"0.11.0\"", replace="juniper = { version = \"{{version}}\""},
{file="../juniper_iron/Cargo.toml", search="juniper = { version = \"0.11.0\"", replace="juniper = { version = \"{{version}}\""},
{file="../juniper_rocket/Cargo.toml", search="juniper = { version = \"0.11.0\"", replace="juniper = { version = \"{{version}}\""},
{file="../juniper_tests/Cargo.toml", search="juniper = { version = \"0.11.0\"", replace="juniper = { version = \"{{version}}\""},
{file="../juniper_warp/Cargo.toml", search="juniper = { version = \"0.11.0\"", replace="juniper = { version = \"{{version}}\""},
{file="release.toml", search="0.11.0", replace="{{version}}"},
]

View file

@ -0,0 +1,8 @@
[tasks.release]
args = ["release"]
[tasks.release-patch]
args = ["release", "patch"]
[tasks.release-dry-run]
args = ["release", "--dry-run"]

View file

@ -0,0 +1,9 @@
dev-version-ext = "pre"
pre-release-commit-message = "Release {{crate_name}} {{version}}"
pro-release-commit-message = "Bump {{crate_name}} version to {{next_version}}"
tag-message = "Release {{crate_name}} {{version}}"
upload-doc = false
pre-release-replacements = [
{file="../juniper/Cargo.toml", search="juniper_codegen = { version = \"0.11.0\"", replace="juniper_codegen = { version = \"{{version}}\""},
{file="release.toml", search="0.11.0", replace="{{version}}"},
]

View file

@ -0,0 +1,5 @@
dev-version-ext = "pre"
pre-release-commit-message = "Release {{crate_name}} {{version}}"
pro-release-commit-message = "Bump {{crate_name}} version to {{next_version}}"
tag-message = "Release {{crate_name}} {{version}}"
upload-doc = false

View file

@ -4,3 +4,12 @@ args = ["build", "--verbose"]
[tasks.test-verbose]
args = ["test", "--verbose"]
[tasks.release]
disabled = true
[tasks.release-patch]
disabled = true
[tasks.release-dry-run]
disabled = true