Skip to content

Commit 28c1164

Browse files
authored
Switch releasing commands from a blocklist to an allowlist (#956)
* Switch releasing commands from a blocklist to an allowlist This is much better as we can hardocde the crates to filter out in one place, can selectively release certain crates easily, and only have one command instead of the "-some" hack * get rid of workaround no longer needed * More makefiles
1 parent 93deb28 commit 28c1164

File tree

6 files changed

+32
-93
lines changed

6 files changed

+32
-93
lines changed

Makefile.toml

+10-60
Original file line numberDiff line numberDiff line change
@@ -2,87 +2,37 @@
22
[env]
33
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "true"
44
CARGO_MAKE_CARGO_ALL_FEATURES = ""
5+
CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = "integration_tests/*;examples/*;juniper_benchmarks;"
6+
57

6-
#
78
# Run `RELEASE_LEVEL=(patch|major|minor) cargo make release` to push a new release of every crate.
8-
# Run `RELEASE_LEVEL=(patch|major|minor) CARGO_MAKE_WORKSPACE_SKIP_MEMBERS="crate1;crate2;" cargo make release`
9-
# to push a new release of some crates.
109
#
11-
10+
# Run `RELEASE_LEVEL=(patch|major|minor) CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS="crate1;crate2;" cargo make release`
11+
# to push a new release of a subset of crates.
1212
[tasks.release]
1313
condition = { env_set = [ "RELEASE_LEVEL" ] }
14-
workspace = false
15-
env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = "integration_tests/*;examples/*;juniper_benchmarks;" }
16-
run_task = { name = "release-INTERNAL", fork = true }
17-
18-
19-
[tasks.release-some]
20-
condition = { env_set = [ "RELEASE_LEVEL", "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" ] }
21-
workspace = false
22-
run_task = { name = "release-INTERNAL", fork = true }
23-
24-
# Hack to filter out crates we do not want to release.
25-
# See <https://github.com/sagiegurari/cargo-make/issues/212#issuecomment-481123564>
26-
[tasks.release-INTERNAL]
27-
private = true
28-
condition = { env_set = [ "RELEASE_LEVEL" ] }
2914
command = "cargo-release"
3015
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/../_build/release.toml", "${RELEASE_LEVEL}"]
3116

3217

33-
#
3418
# Run `RELEASE_LEVEL=(patch|major|minor) cargo make release-dry-run` to do a dry run.
35-
# Run `RELEASE_LEVEL=(patch|major|minor) CARGO_MAKE_WORKSPACE_SKIP_MEMBERS="crate1;crate2;" cargo make release-some-dry-run`
36-
# to do a dry run with some crates.
3719
#
38-
20+
# Run `RELEASE_LEVEL=(patch|major|minor) CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS="crate1;crate2;" cargo make release-dry-run`
21+
# to do a dry run of a subset of crates.
3922
[tasks.release-dry-run]
4023
condition = { env_set = [ "RELEASE_LEVEL" ] }
41-
workspace = false
42-
env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = "integration_tests/*;examples/*;juniper_benchmarks;" }
43-
run_task = { name = "release-dry-run-INTERNAL", fork = true }
44-
45-
[tasks.release-some-dry-run]
46-
condition = { env_set = [ "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS", "RELEASE_LEVEL" ] }
47-
workspace = false
48-
run_task = { name = "release-some-dry-run-INTERNAL", fork = true }
49-
50-
51-
# Hack to filter out crates we do not want to release.
52-
# See <https://github.com/sagiegurari/cargo-make/issues/212#issuecomment-481123564>
53-
[tasks.release-dry-run-INTERNAL]
54-
private = true
55-
condition = { env_set = [ "RELEASE_LEVEL" ] }
56-
env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = "integration_tests/*;examples/*;juniper_benchmarks;" }
5724
description = "Run `cargo-release --dry-run` for every crate"
5825
command = "cargo-release"
5926
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/../_build/release.toml", "--dry-run", "${RELEASE_LEVEL}"]
6027

61-
#
62-
# Run `RELEASE_LEVEL=(patch|major|minor) cargo make release-local-test` to do actually make changes locally but
28+
29+
# Run `RELEASE_LEVEL=(patch|major|minor) cargo make release-local-test` to actually make changes locally but
6330
# not push them up to crates.io or Github.
64-
# Run `RELEASE_LEVEL=(patch|major|minor) cargo make release-some-local-test` to do actually make changes locally but
65-
# not push some crates up to crates.io or Github.
6631
#
67-
32+
# Run `RELEASE_LEVEL=(patch|major|minor) CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS="crate1;crate2;" cargo make release-local-test` to actually make changes locally but
33+
# not push some crates up to crates.io or Github.
6834
[tasks.release-local-test]
6935
condition = { env_set = [ "RELEASE_LEVEL" ] }
70-
workspace = false
71-
env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = "integration_tests/*;examples/*;juniper_benchmarks;" }
72-
run_task = { name = "release-local-test-INTERNAL", fork = true }
73-
74-
75-
[tasks.release-some-local-test]
76-
condition = { env_set = [ "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS", "RELEASE_LEVEL" ] }
77-
workspace = false
78-
run_task = { name = "release-local-test-INTERNAL", fork = true }
79-
80-
81-
# Hack to filter out crates we do not want to release.
82-
# See <https://github.com/sagiegurari/cargo-make/issues/212#issuecomment-481123564>
83-
[tasks.release-local-test-INTERNAL]
84-
private = true
85-
condition = { env_set = [ "RELEASE_LEVEL" ] }
8636
description = "Run `cargo-release` for every crate, but only make changes locally"
8737
command = "cargo-release"
8838
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/../_build/release.toml", "--no-confirm", "--skip-publish", "--skip-push", "--skip-tag", "${RELEASE_LEVEL}"]

RELEASING.md

+10-21
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,43 @@ We use [`cargo-make`](cargo-make) and [`cargo-release`](cargo-release) to automa
2020

2121
## Preparing for a release
2222

23-
There are two general classes of release and each require running different automation commands:
23+
There are two general classes of releases:
2424

25-
1. All public workspace crates should be released and all share the same release level ("patch", "minor", "major"). _These commands take the form `release-[whatever]`._
25+
1. All public workspace crates should be released and all share the same release level ("patch", "minor", "major").
2626

27-
2. A subset of workspace crates need to be released, or not all crate releases share the same release level. _These commands start with `release-skip-[whatever]`._
27+
2. A subset of workspace crates need to be released, or not all crate releases share the same release level.
2828

2929
**All release commands must be run from the root directory of the repository.**
3030

3131
## Determine new release level
3232

3333
For each crate, determine the desired release level (`patch`, `minor`, `major`). Set the `RELEASE_LEVEL` env variable to the desired release level.
3434

35-
## Determine which crates to exclude
35+
## Determine which crates to release
3636

37-
If a subset of workspace crates need to be released, or not all crate releases share the same release level, set the `CARGO_MAKE_WORKSPACE_SKIP_MEMBERS` env
38-
variable to filter out specific workspace crates. The value is a list of semicolon-delineated crate names or a regular expression.
39-
40-
**Important:** You likely want to always exclude `integration_tests/*`.
37+
If a subset of workspace crates need to be released, or not all crate releases share the same release level, set the `CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS` env
38+
variable to choose specific workspace crates. The value is a list of semicolon-delineated crate names or a regular expressions.
4139

4240
## Dry run
4341

4442
It is a good idea to do a dry run to sanity check what actions will be performed.
4543

4644
- For case #1 above, run `cargo make release-dry-run`.
45+
- For case #2 above, run `CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS="crate1;crate2" cargo make release-dry-run`.
4746

4847
If the command finishes super quickly with no output you likely did not set `RELEASE_LEVEL`.
4948

50-
- For case #2 above, run `cargo make release-some-dry-run`.
51-
52-
If the command finishes super quickly with no output you likely did not set `RELEASE_LEVEL` or `CARGO_MAKE_WORKSPACE_SKIP_MEMBERS`.
53-
5449
## Local test
5550

5651
Not everything is captured in the dry run. It is a good idea to run a local test.
5752
In a local test, all the release actions are performed on your local checkout
5853
but nothing is pushed to Github or crates.io.
5954

6055
- For case #1 above, run `cargo make release-local-test`.
56+
- For case #2 above, run `CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS="crate1;crate2" cargo make release-local-test`.
6157

6258
If the command finishes super quickly with no output you likely did not set `RELEASE_LEVEL`.
6359

64-
- For case #2 above, run `cargo make release-some-local-test`.
65-
66-
If the command finishes super quickly with no output you likely did not set `RELEASE_LEVEL` or `CARGO_MAKE_WORKSPACE_SKIP_MEMBERS`.
67-
6860
After, your local git repository should have the changes ready to push to Github.
6961
Use `git rebase -i HEAD~10` and drop the new commits.
7062

@@ -74,12 +66,9 @@ After testing locally and via a dry run, it is time to release. A release
7466
consists of bumping versions, starting a new changelog section, pushing a tag to Github, and updating crates.io. This should all be handled by running the automated commands.
7567

7668
- For case #1 above, run `cargo make release`.
69+
- For case #2 above, run `CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS="crate1;crate2" cargo make release`.
7770

78-
If the command finishes super quickly with no output you likely did not set `RELEASE_LEVEL`.
79-
80-
- For case #2 above, run `cargo make release-some`.
81-
82-
If the command finishes super quickly with no output you likely did not set `RELEASE_LEVEL` or `CARGO_MAKE_WORKSPACE_SKIP_MEMBERS`.
71+
If the command finishes super quickly with no output you likely did not set `RELEASE_LEVEL`,
8372

8473
[cargo-make]: https://github.com/sagiegurari/cargo-make
8574
[cargo-release]: https://github.com/sunng87/cargo-release

juniper/Makefile.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
[env]
44
CARGO_MAKE_CARGO_ALL_FEATURES = ""
55

6-
[tasks.release-INTERNAL]
6+
[tasks.release]
77
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "${RELEASE_LEVEL}"]
88

9-
[tasks.release-dry-run-INTERNAL]
9+
[tasks.release-dry-run]
1010
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "--dry-run", "${RELEASE_LEVEL}"]
1111

12-
[tasks.release-local-test-INTERNAL]
12+
[tasks.release-local-test]
1313
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "--no-confirm", "--skip-publish", "--skip-push", "--skip-tag", "${RELEASE_LEVEL}"]
1414

1515
[tasks.test]

juniper_codegen/Makefile.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# This is needed as the release config is at a different path than the top-level
22
# release config.
33

4-
[tasks.release-INTERNAL]
4+
[tasks.release]
55
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "${RELEASE_LEVEL}"]
66

7-
[tasks.release-dry-run-INTERNAL]
7+
[tasks.release-dry-run]
88
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "--dry-run", "${RELEASE_LEVEL}"]
99

10-
[tasks.release-local-test-INTERNAL]
10+
[tasks.release-local-test]
1111
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "--no-confirm", "--skip-publish", "--skip-push", "--skip-tag", "${RELEASE_LEVEL}"]

juniper_graphql_ws/Makefile.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# This is needed as the release config is at a different path than the top-level
22
# release config.
33

4-
[tasks.release-INTERNAL]
4+
[tasks.release]
55
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "${RELEASE_LEVEL}"]
66

7-
[tasks.release-dry-run-INTERNAL]
7+
[tasks.release-dry-run]
88
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "--dry-run", "${RELEASE_LEVEL}"]
99

10-
[tasks.release-local-test-INTERNAL]
10+
[tasks.release-local-test]
1111
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "--no-confirm", "--skip-publish", "--skip-push", "--skip-tag", "${RELEASE_LEVEL}"]
1212

1313
[env]

juniper_subscriptions/Makefile.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# This is needed as the release config is at a different path than the top-level
33
# release config.
44

5-
[tasks.release-INTERNAL]
5+
[tasks.release]
66
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "${RELEASE_LEVEL}"]
77

8-
[tasks.release-dry-run-INTERNAL]
8+
[tasks.release-dry-run]
99
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "--dry-run", "${RELEASE_LEVEL}"]
1010

11-
[tasks.release-local-test-INTERNAL]
11+
[tasks.release-local-test]
1212
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/release.toml", "--no-confirm", "--skip-publish", "--skip-push", "--skip-tag", "${RELEASE_LEVEL}"]
1313

1414
[env]

0 commit comments

Comments
 (0)