Skip to content

Commit cbd3c6b

Browse files
authored
Merge pull request apache#263 from ballista-compute/documentation/cargo-release-config
add a note about cargo release config
2 parents 929fc67 + 0ac343a commit cbd3c6b

File tree

3 files changed

+44
-20
lines changed

3 files changed

+44
-20
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
github-token: ${{ secrets.GITHUB_TOKEN }}
6666

6767
publish-crate:
68-
if: startsWith(github.ref, 'refs/tags/')
68+
if: startsWith(github.ref, 'refs/tags/v0')
6969
runs-on: ubuntu-latest
7070
needs: [test]
7171
steps:

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,7 @@ simple_logger = "1.9"
3636
matches = "0.1"
3737

3838
[package.metadata.release]
39+
# Instruct `cargo release` to not run `cargo publish` locally:
40+
# https://github.com/sunng87/cargo-release/blob/master/docs/reference.md#config-fields
41+
# See docs/releasing.md for details.
3942
disable-publish = true

docs/releasing.md

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Releasing
22

3-
Releasing, i.e. crate publishing, has been automated via GitHub Actions.
3+
## Prerequisites
4+
Publishing to crates.io has been automated via GitHub Actions, so you will only
5+
need push access to the [ballista-compute GitHub repository](https://github.com/ballista-compute/sqlparser-rs)
6+
in order to publish a release.
47

58
We use the [`cargo release`](https://github.com/sunng87/cargo-release)
69
subcommand to ensure correct versioning. Install via:
@@ -9,29 +12,47 @@ subcommand to ensure correct versioning. Install via:
912
$ cargo install cargo-release
1013
```
1114

12-
**Before releasing** ensure `CHANGELOG.md` is updated appropriately.
13-
1415
## Process
1516

16-
Using `cargo-release` we can author a new minor release like so:
17+
1. **Before releasing** ensure `CHANGELOG.md` is updated appropriately and that
18+
you have a clean checkout of the `main` branch of the sqlparser repository:
19+
```
20+
$ git fetch && git status
21+
On branch main
22+
Your branch is up to date with 'upstream/main'.
1723
18-
```
19-
$ cargo release minor --skip-publish
20-
```
24+
nothing to commit, working tree clean
25+
```
26+
* If you have the time, check that the examples in the README are up to date.
2127
22-
**Ensure publishing is skipped** since pushing the resulting tag upstream will
23-
handle crate publishing automatically.
28+
2. Using `cargo-release` we can publish a new release like so:
2429
25-
This will create a new tag, `0.6.0` with the message,
26-
`(cargo-release) sqlparser version 0.6.0`.
30+
```
31+
$ cargo release minor --push-remote upstream
32+
```
2733
28-
Once the tag is created, pushing the tag upstream will trigger a publishing
29-
process to crates.io. Now to push our example tag:
34+
You can add `--dry-run` to see what the command is going to do,
35+
or `--skip-push` to stop before actually publishing the release.
3036
31-
```
32-
git push origin 0.6.0
33-
```
37+
`cargo release` will then:
38+
39+
* Bump the minor part of the version in `Cargo.toml` (e.g. `0.7.1-alpha.0`
40+
-> `0.8.0`. You can use `patch` instead of `minor`, as appropriate).
41+
* Create a new tag (e.g. `v0.8.0`) locally
42+
* Push the new tag to the specified remote (`upstream` in the above
43+
example), which will trigger a publishing process to crates.io as part of
44+
the [corresponding GitHub Action](https://github.com/ballista-compute/sqlparser-rs/blob/main/.github/workflows/rust.yml).
45+
46+
Note that credentials for authoring in this way are securely stored in
47+
the (GitHub) repo secrets as `CRATE_TOKEN`.
48+
* Bump the crate version again (to something like `0.8.1-alpha.0`) to
49+
indicate the start of new development cycle.
50+
51+
3. Push the updates to the `main` branch upstream:
52+
```
53+
$ git push upstream
54+
```
55+
56+
4. Check that the new version of the crate is available on crates.io:
57+
https://crates.io/crates/sqlparser
3458
35-
(Note that this process is fully automated; credentials
36-
for authoring in this way are securely stored in the repo secrets as
37-
`CRATE_TOKEN`.)

0 commit comments

Comments
 (0)