This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new f9f037b  Update Cargo.toml, release instructions and release script
f9f037b is described below

commit f9f037bd5a9776ff1f7e28b530418299d102d8d3
Author: Allen George <allen.geo...@gmail.com>
AuthorDate: Thu Dec 27 13:56:21 2018 -0500

    Update Cargo.toml, release instructions and release script
    
    Client: rs
---
 lib/rs/Cargo.toml   |  2 +-
 lib/rs/RELEASING.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/rs/release.sh   | 26 ++++++++++++++++++++++++
 3 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/lib/rs/Cargo.toml b/lib/rs/Cargo.toml
index f5844b4..ed32179 100644
--- a/lib/rs/Cargo.toml
+++ b/lib/rs/Cargo.toml
@@ -7,7 +7,7 @@ authors = ["Apache Thrift Developers <d...@thrift.apache.org>"]
 homepage = "http://thrift.apache.org";
 documentation = "https://thrift.apache.org";
 readme = "README.md"
-exclude = ["Makefile*", "test/**"]
+exclude = ["Makefile*", "test/**", "*.iml"]
 keywords = ["thrift"]
 
 [dependencies]
diff --git a/lib/rs/RELEASING.md b/lib/rs/RELEASING.md
new file mode 100644
index 0000000..073d7a0
--- /dev/null
+++ b/lib/rs/RELEASING.md
@@ -0,0 +1,57 @@
+# Publishing the thrift crate
+
+Publishing the Rust thrift crate is straightforward, and involves two major 
steps:
+
+1. Setting up your [crates.io](https://www.crates.io) account _(one-time)_
+
+2. Packaging/publishing the Rust thrift crate itself
+
+## Set up your crates.io account (one-time)
+
+1. Go to [crates.io](https://www.crates.io) and click the `Log In` button at 
the top right.
+
+   Log in **as the Github user with write permissions to the thrift repo!**
+
+2. Click your user icon button at the top right and select `Account Settings`.
+
+3. Click `New Token` next to `API Access`.
+
+   This generates a new API key that cargo uses to publish packages to 
crates.io.
+   Store this API key somewhere safe. If you will only use this Github account 
to
+   publish crates to crates.io you can follow the instructions to save the
+   generated key to `~/.cargo/credentials`.
+
+## Package and Publish
+
+You can use the automated script or run the release steps manually.
+
+**Important**: `cargo` expects that version numbers follow the semantic 
versioning format.
+This means that `THRIFT_RELEASE_VERSION` must have a major, minor and patch 
number, i.e., must
+be in the form `#.##.##`.
+
+#### Automated
+
+Run `./release.sh [THRIFT_RELEASE_VERSION]`.
+
+_Requires you to have stored your credentials in `~/.cargo/credentials`._
+
+#### Manual
+
+1. Edit `Cargo.toml` and update the `version = 1.0` key to `version = 
[THRIFT_RELEASE_VERSION]`
+
+2. `git add Cargo.toml`
+
+3. `git commit -m "Update thrift crate version to [THRIFT_RELEASE_VERSION]" -m 
"Client: rs"`
+
+4. `cargo login`
+
+    _(not required if you have stored your credentials in 
`~/.cargo/credentials`)_
+
+5. `cargo clean`
+
+6. `cargo package`
+
+   This step fails if there are any uncommitted or ignored files. Do **not** 
use the `--allow-dirty`
+   flag! Instead, add the highlighted files as entries in the `Cargo.toml` 
`exclude` key.
+
+7. `cargo publish`
diff --git a/lib/rs/release.sh b/lib/rs/release.sh
new file mode 100755
index 0000000..c4e5b48
--- /dev/null
+++ b/lib/rs/release.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+if ! [[ $# -eq 1 && $1 =~ ^[0-9](\.[0-9][0-9]*){2}$ ]]; then
+    (>&2 echo "Usage: ./publish-crate.sh [THRIFT_RELEASE_VERSION] ")
+    (>&2 echo "       THRIFT_RELEASE_VERSION is in semantic versioning format, 
i.e. #.##.##")
+    exit 1
+fi
+
+THRIFT_RELEASE_VERSION=${1:-}
+
+echo "Updating Cargo.toml to ${THRIFT_RELEASE_VERSION}"
+sed -i.old -e "s/^version = .*$/version = \"${THRIFT_RELEASE_VERSION}\"/g" 
Cargo.toml
+rm Cargo.toml.old
+
+echo "Committing updated Cargo.toml"
+git add Cargo.toml
+git commit -m "Update thrift crate version to ${THRIFT_RELEASE_VERSION}" -m 
"Client: rs"
+
+echo "Packaging and releasing rust thrift crate with version 
${THRIFT_RELEASE_VERSION}"
+cargo clean
+cargo package
+cargo publish

Reply via email to