From fcf1eb1b67c4e8ecef9dad90f9b52231d36937b5 Mon Sep 17 00:00:00 2001 From: Max Countryman Date: Fri, 14 Aug 2020 10:47:35 -0700 Subject: [PATCH 1/3] add a note about cargo release config --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index beed4db17..fda803b06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,4 +36,6 @@ simple_logger = "1.6" matches = "0.1" [package.metadata.release] +# We want to ensure we don't publish via `cargo release` since Actions +# handles this for us. disable-publish = true From cc4f51fe10ca6b6dc63915c7f2947878d0a672b6 Mon Sep 17 00:00:00 2001 From: Nickolay Ponomarev Date: Sun, 27 Sep 2020 21:54:01 +0300 Subject: [PATCH 2/3] Update releasing.md docs --- Cargo.toml | 5 ++-- docs/releasing.md | 59 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fda803b06..827c5d514 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,7 @@ simple_logger = "1.6" matches = "0.1" [package.metadata.release] -# We want to ensure we don't publish via `cargo release` since Actions -# handles this for us. +# Instruct `cargo release` to not run `cargo publish` locally: +# https://github.com/sunng87/cargo-release/blob/master/docs/reference.md#config-fields +# See docs/releasing.md for details. disable-publish = true diff --git a/docs/releasing.md b/docs/releasing.md index 66b41901b..58509eca6 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,6 +1,9 @@ # Releasing -Releasing, i.e. crate publishing, has been automated via GitHub Actions. +## Prerequisites +Publishing to crates.io has been automated via GitHub Actions, so you will only +need push access to the [ballista-compute GitHub repository](https://github.com/ballista-compute/sqlparser-rs) +in order to publish a release. We use the [`cargo release`](https://github.com/sunng87/cargo-release) subcommand to ensure correct versioning. Install via: @@ -9,29 +12,47 @@ subcommand to ensure correct versioning. Install via: $ cargo install cargo-release ``` -**Before releasing** ensure `CHANGELOG.md` is updated appropriately. - ## Process -Using `cargo-release` we can author a new minor release like so: +1. **Before releasing** ensure `CHANGELOG.md` is updated appropriately and that + you have a clean checkout of the `main` branch of the sqlparser repository: + ``` + $ git fetch && git status + On branch main + Your branch is up to date with 'upstream/main'. -``` -$ cargo release minor --skip-publish -``` + nothing to commit, working tree clean + ``` + * If you have the time, check that the examples in the README are up to date. -**Ensure publishing is skipped** since pushing the resulting tag upstream will -handle crate publishing automatically. +2. Using `cargo-release` we can publish a new release like so: -This will create a new tag, `0.6.0` with the message, -`(cargo-release) sqlparser version 0.6.0`. + ``` + $ cargo release minor --push-remote upstream + ``` -Once the tag is created, pushing the tag upstream will trigger a publishing -process to crates.io. Now to push our example tag: + You can add `--dry-run` to see what the command is going to do, + or `--skip-push` to stop before actually publishing the release. -``` -git push origin 0.6.0 -``` + `cargo release` will then: + + * Bump the minor part of the version in `Cargo.toml` (e.g. `0.7.1-alpha.0` + -> `0.8.0`. You can use `patch` instead of `minor`, as appropriate). + * Create a new tag (e.g. `v0.8.0`) locally + * Push the new tag to the specified remote (`upstream` in the above + example), which will trigger a publishing process to crates.io as part of + the [corresponding GitHub Action](https://github.com/ballista-compute/sqlparser-rs/blob/main/.github/workflows/rust.yml). + + Note that credentials for authoring in this way are securely stored in + the (GitHub) repo secrets as `CRATE_TOKEN`. + * Bump the crate version again (to something like `0.8.1-alpha.0`) to + indicate the start of new development cycle. + +3. Push the updates to the `main` branch upstream: + ``` + $ git push upstream + ``` + +4. Check that the new version of the crate is available on crates.io: + https://crates.io/crates/sqlparser -(Note that this process is fully automated; credentials -for authoring in this way are securely stored in the repo secrets as -`CRATE_TOKEN`.) From 0ac343a11648013163f65cbf57e1272b26a5c344 Mon Sep 17 00:00:00 2001 From: Nickolay Ponomarev Date: Sun, 27 Sep 2020 23:36:41 +0300 Subject: [PATCH 3/3] Don't publish on the push of any tag The tags are named vX.Y, and we'll be 0.x for a while, so limiting the publish-crate action to run v0 tags seems good enough to avoid accidental publishes. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6401d8e5c..078d8bae0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -65,7 +65,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} publish-crate: - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/v0') runs-on: ubuntu-latest needs: [test] steps: