Automate cargo crate publish process (#34)

* Added package metadata to cargo.toml

* Added license info:

* Testing rust ci

* Fixed ci event to push, pull_request

* Testing publish dry run

* Added lint and publish steps

* test push

* testing publish with dry run

* changed version to match other sdks

* updated README, added build badges

* bump crate version

* update readme

* fixed typo

* added push tag condition for crate publish
:
This commit is contained in:
Gurpreet Singh 2020-12-15 08:54:27 -08:00 committed by GitHub
parent 85b1fe0d94
commit e7649325fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 2 deletions

54
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: dapr-rust-sdk
on:
push:
branches:
- master
- release-*
tags:
- v*
pull_request:
branches:
- master
- release-*
env:
CARGO_TERM_COLOR: always
CARGO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: cargo fmt
run: cargo fmt -- --check --color ${{ env.CARGO_TERM_COLOR }}
- name: cargo clippy
run: cargo clippy -- -W warnings
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build
- name: Build examples
run: cargo build --examples
- name: Run Tests
run: cargo test --all-targets
publish:
name: Publish
runs-on: ubuntu-latest
needs: [lint, build]
if: startswith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- name: cargo publish
run: cargo publish --token ${{ env.CARGO_TOKEN }}

View File

@ -1,8 +1,14 @@
[package]
name = "dapr"
version = "0.2.0"
version = "0.2.0-alpha.0"
authors = ["dapr.io"]
edition = "2018"
license-file = "LICENSE"
repository = "https://github.com/dapr/rust-sdk"
description = "Rust SDK for dapr"
readme = "README.md"
keywords = ["microservices", "dapr"]
[dependencies]
tonic = "0.2"

View File

@ -1,6 +1,15 @@
# Dapr SDK for Rust
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Crates.io][crates-badge]][crates-url]
[![Build Status][actions-badge]][actions-url]
[![License: MIT][mit-badge]][mit-url]
[crates-badge]: https://img.shields.io/crates/v/dapr.svg
[crates-url]: https://crates.io/crates/dapr
[mit-badge]: https://img.shields.io/badge/License-MIT-yellow.svg
[mit-url]: https://github.com/dapr/rust-sdk/blob/master/LICENSE
[actions-badge]: https://github.com/dapr/rust-sdk/workflows/dapr-rust-sdk/badge.svg
[actions-url]: https://github.com/dapr/rust-sdk/actions?query=workflow%3Adapr-rust-sdk
⚠ Work in Progress ⚠
@ -15,9 +24,16 @@ Dapr is a portable, event-driven, serverless runtime for building distributed ap
## Usage
```toml
[dependencies]
dapr = "0.2.0-alpha.0"
```
A client can be created as follows:
```rust
use dapr;
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Get the Dapr port and create a connection
let port: u16 = std::env::var("DAPR_GRPC_PORT")?.parse()?;