Skip to content

Commit e764932

Browse files
authored
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 :
1 parent 85b1fe0 commit e764932

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: dapr-rust-sdk
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release-*
8+
tags:
9+
- v*
10+
pull_request:
11+
branches:
12+
- master
13+
- release-*
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
CARGO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
18+
19+
jobs:
20+
lint:
21+
name: Lint
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: cargo fmt
27+
run: cargo fmt -- --check --color ${{ env.CARGO_TERM_COLOR }}
28+
- name: cargo clippy
29+
run: cargo clippy -- -W warnings
30+
31+
32+
build:
33+
name: Build
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- uses: actions/checkout@v2
38+
- name: Build
39+
run: cargo build
40+
- name: Build examples
41+
run: cargo build --examples
42+
- name: Run Tests
43+
run: cargo test --all-targets
44+
45+
publish:
46+
name: Publish
47+
runs-on: ubuntu-latest
48+
needs: [lint, build]
49+
if: startswith(github.ref, 'refs/tags/v')
50+
51+
steps:
52+
- uses: actions/checkout@v2
53+
- name: cargo publish
54+
run: cargo publish --token ${{ env.CARGO_TOKEN }}

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
[package]
22
name = "dapr"
3-
version = "0.2.0"
3+
version = "0.2.0-alpha.0"
44
authors = ["dapr.io"]
55
edition = "2018"
6+
license-file = "LICENSE"
7+
repository = "https://github.com/dapr/rust-sdk"
8+
description = "Rust SDK for dapr"
9+
readme = "README.md"
10+
keywords = ["microservices", "dapr"]
11+
612

713
[dependencies]
814
tonic = "0.2"

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Dapr SDK for Rust
22

3-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3+
[![Crates.io][crates-badge]][crates-url]
4+
[![Build Status][actions-badge]][actions-url]
5+
[![License: MIT][mit-badge]][mit-url]
6+
7+
[crates-badge]: https://img.shields.io/crates/v/dapr.svg
8+
[crates-url]: https://crates.io/crates/dapr
9+
[mit-badge]: https://img.shields.io/badge/License-MIT-yellow.svg
10+
[mit-url]: https://github.com/dapr/rust-sdk/blob/master/LICENSE
11+
[actions-badge]: https://github.com/dapr/rust-sdk/workflows/dapr-rust-sdk/badge.svg
12+
[actions-url]: https://github.com/dapr/rust-sdk/actions?query=workflow%3Adapr-rust-sdk
413

514
⚠ Work in Progress ⚠
615

@@ -15,9 +24,16 @@ Dapr is a portable, event-driven, serverless runtime for building distributed ap
1524

1625
## Usage
1726

27+
```toml
28+
[dependencies]
29+
dapr = "0.2.0-alpha.0"
30+
```
31+
1832
A client can be created as follows:
1933

2034
```rust
35+
use dapr;
36+
2137
async fn main() -> Result<(), Box<dyn std::error::Error>> {
2238
// Get the Dapr port and create a connection
2339
let port: u16 = std::env::var("DAPR_GRPC_PORT")?.parse()?;

0 commit comments

Comments
 (0)