From bc9bfaeb84d9a04653fe6b8678ea7fa66f1ec424 Mon Sep 17 00:00:00 2001 From: Max Countryman Date: Sat, 25 Jul 2020 08:05:34 -0700 Subject: [PATCH 1/4] automate crate publishing This introduces a new section of the GitHub Actions workflow which will publish the crate upon a new tag being pushed. Note that this requires a new project secret, `CRATES_TOKEN`. --- .github/workflows/rust.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a53e0bab..3fa2aac5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -63,3 +63,16 @@ jobs: uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} + + publish-crate: + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + needs: [test] + steps: + - name: Set up Rust + uses: hecrj/setup-rust-action@v1 + - uses: actions/checkout@v2 + - name: Publish + shell: bash + run: | + cargo publish --token ${{ secrets.CRATES_TOKEN }} From 1a70c6e1fedf4c32b800264f63c50517d3380db3 Mon Sep 17 00:00:00 2001 From: Max Countryman Date: Fri, 31 Jul 2020 09:18:34 -0700 Subject: [PATCH 2/4] document initial release process --- docs/releasing.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 docs/releasing.md diff --git a/docs/releasing.md b/docs/releasing.md new file mode 100644 index 00000000..ae7d8505 --- /dev/null +++ b/docs/releasing.md @@ -0,0 +1,32 @@ +# Releasing + +Releasing, i.e. crate publishing, has been automated via GitHub Actions. + +In order to author a new release, you simply tag the desired revision and push +the resulting tag. + +**Before releasing** ensure `CHANGELOG.md` is updated appropriately as well as +`Cargo.toml`. + +## Process + +Please ensure you follow the correct format when creating new tags. For +instance: + +``` +git tag -a '0.6.0' -m '(cargo-release) sqlparser version 0.6.0' +``` + +This will create a new tag, `0.6.0` which the message, +`(cargo-release) sqlparser version 0.6.0`. + +Once the tag is created, pushing the tag upstream will trigger a publishing +process to crates.io. Now to push our example tag: + +``` +git push origin 0.6.0 +``` + +(Note that this process is fully automated; credentials +for authoring in this way are securely stored in the repo secrets as +`CRATE_TOKEN`.) From 6b37c1642fd0bd584e0fd29cbbd3ed4fe6f5e235 Mon Sep 17 00:00:00 2001 From: Max Countryman Date: Fri, 31 Jul 2020 09:34:51 -0700 Subject: [PATCH 3/4] fix typo --- docs/releasing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/releasing.md b/docs/releasing.md index ae7d8505..2cc6535d 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -17,7 +17,7 @@ instance: git tag -a '0.6.0' -m '(cargo-release) sqlparser version 0.6.0' ``` -This will create a new tag, `0.6.0` which the message, +This will create a new tag, `0.6.0` with the message, `(cargo-release) sqlparser version 0.6.0`. Once the tag is created, pushing the tag upstream will trigger a publishing From 9351efb437f27d2c36fa4f1582ff9a1e01d50e15 Mon Sep 17 00:00:00 2001 From: Max Countryman Date: Sat, 1 Aug 2020 07:30:41 -0700 Subject: [PATCH 4/4] update release instructions --- Cargo.toml | 3 +++ docs/releasing.md | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 95c2ec9b..81a3c64e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,3 +34,6 @@ serde_json = { version = "1.0", optional = true } [dev-dependencies] simple_logger = "1.0.1" matches = "0.1" + +[package.metadata.release] +disable-publish = true diff --git a/docs/releasing.md b/docs/releasing.md index 2cc6535d..66b41901 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -2,21 +2,26 @@ Releasing, i.e. crate publishing, has been automated via GitHub Actions. -In order to author a new release, you simply tag the desired revision and push -the resulting tag. +We use the [`cargo release`](https://github.com/sunng87/cargo-release) +subcommand to ensure correct versioning. Install via: -**Before releasing** ensure `CHANGELOG.md` is updated appropriately as well as -`Cargo.toml`. +``` +$ cargo install cargo-release +``` + +**Before releasing** ensure `CHANGELOG.md` is updated appropriately. ## Process -Please ensure you follow the correct format when creating new tags. For -instance: +Using `cargo-release` we can author a new minor release like so: ``` -git tag -a '0.6.0' -m '(cargo-release) sqlparser version 0.6.0' +$ cargo release minor --skip-publish ``` +**Ensure publishing is skipped** since pushing the resulting tag upstream will +handle crate publishing automatically. + This will create a new tag, `0.6.0` with the message, `(cargo-release) sqlparser version 0.6.0`.