Skip to content

Commit c52f2b4

Browse files
authored
Prepare crates for publishing to crates.io (#12)
This PR adds Github actions needed for manual publish of `chainlink-data-streams-report` and `chainlink-data-streams-sdk` crates to [crates.io](https://crates.io)
1 parent e078871 commit c52f2b4

File tree

7 files changed

+129
-50
lines changed

7 files changed

+129
-50
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# data-streams-sdk
2+
23
Chainlink Data Streams client SDK implementation.
34

45
See the language directories for specific documentation, usage and examples.
56

67
## [Go](go/README.md) [![go.dev reference](https://img.shields.io/badge/go-reference-blue)](https://pkg.go.dev/github.com/smartcontractkit/data-streams-sdk/go) [![Go Report Card](https://goreportcard.com/badge/github.com/smartcontractkit/data-streams-sdk/go)](https://goreportcard.com/report/github.com/smartcontractkit/data-streams-sdk/go) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smartcontractkit/data-streams-sdk/blob/main/LICENSE)
8+
9+
## [Rust](rust/README.md) ![Crates.io sdk](https://img.shields.io/crates/v/chainlink-data-streams-sdk?label=chainlink-data-streams-sdk) ![Crates.io report](https://img.shields.io/crates/v/chainlink-data-streams-report?label=chainlink-data-streams-report) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smartcontractkit/data-streams-sdk/blob/main/LICENSE)

rust/Cargo.lock

Lines changed: 37 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ The Data Streams SDK is a Rust library that provides a convenient way to consume
1111

1212
The project is organized into the following crates:
1313

14-
- `data-streams-report` - The crate that provides the data structures for the reports.
15-
- `data-streams-sdk` - The main crate that provides the REST and WebSocket clients.
14+
- `chainlink-data-streams-report` - The crate that provides the data structures for the reports.
15+
- `chainlink-data-streams-sdk` - The main crate that provides the REST and WebSocket clients.
1616

1717
## Installation
1818

1919
Add the following to your `Cargo.toml`:
2020

2121
```toml
2222
[dependencies]
23-
data-streams-sdk = { git = "https://github.com/smartcontractkit/data-streams-sdk.git", subdir = "rust/crates/sdk" }
23+
chainlink-data-streams-sdk = { version = "0.1.0", features = ["full"] }
2424
```
2525

2626
#### Features
@@ -37,10 +37,10 @@ data-streams-sdk = { git = "https://github.com/smartcontractkit/data-streams-sdk
3737
Here is the basic example that demontstrates how to get the latest report for a ETH/USD feed on Arbitrum Sepolia:
3838

3939
```rust
40-
use data_streams_report::feed_id::ID;
41-
use data_streams_report::report::{decode_full_report, v3::ReportDataV3};
42-
use data_streams_sdk::client::Client;
43-
use data_streams_sdk::config::Config;
40+
use chainlink_data_streams_report::feed_id::ID;
41+
use chainlink_data_streams_report::report::{decode_full_report, v3::ReportDataV3};
42+
use chainlink_data_streams_sdk::client::Client;
43+
use chainlink_data_streams_sdk::config::Config;
4444
use std::error::Error;
4545

4646
#[tokio::main]
@@ -94,9 +94,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
9494
Here is the basic example that demonstrates how to connect to the Data Streams WebSocket server and subscribe to a single stream of ETH/USD Feed Reports on Arbitrum Sepolia:
9595

9696
```rust
97-
use data_streams_report::feed_id::ID;
98-
use data_streams_sdk::config::Config;
99-
use data_streams_sdk::stream::Stream;
97+
use chainlink_data_streams_report::feed_id::ID;
98+
use chainlink_data_streams_sdk::config::Config;
99+
use chainlink_data_streams_sdk::stream::Stream;
100100
use tokio::signal;
101101
use tracing_subscriber::fmt::time::UtcTime;
102102

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Chainlink Data Streams Report Crate
2+
3+
on:
4+
push:
5+
tags:
6+
- "rust/chainlink-data-streams-report-v*"
7+
workflow_dispatch: # Keeping manual trigger as fallback
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
environment: publish
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Rust
19+
uses: dtolnay/rust-toolchain@stable
20+
21+
- name: Verify tag matches version
22+
run: |
23+
VERSION=$(grep '^version = "' rust/crates/report/Cargo.toml | cut -d '"' -f2)
24+
TAG_VERSION=${GITHUB_REF#refs/tags/rust/chainlink-data-streams-report-v}
25+
if [ "$VERSION" != "$TAG_VERSION" ]; then
26+
echo "Version mismatch: Cargo.toml ($VERSION) != tag ($TAG_VERSION)"
27+
exit 1
28+
fi
29+
30+
- name: Publish chainlink-data-streams-report
31+
run: |
32+
cd rust/crates/report
33+
cargo publish --token ${CARGO_DATA_STREAMS_SDK}
34+
if ! cargo owner --list | grep -q "github:smartcontractkit:RustCrates"; then
35+
cargo owner --add github:smartcontractkit:RustCrates
36+
fi
37+
env:
38+
CARGO_DATA_STREAMS_SDK: ${{ secrets.CARGO_DATA_STREAMS_SDK }}

rust/crates/report/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "data-streams-report"
2+
name = "chainlink-data-streams-report"
33
version = "0.0.1"
44
edition = "2021"
55
description = "Chainlink Data Streams Report"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Chainlink Data Streams SDK Crate
2+
3+
on:
4+
push:
5+
tags:
6+
- "rust/chainlink-data-streams-sdk-v*"
7+
workflow_dispatch: # Keeping manual trigger as fallback
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
environment: publish
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Rust
19+
uses: dtolnay/rust-toolchain@stable
20+
21+
- name: Verify tag matches version
22+
run: |
23+
VERSION=$(grep '^version = "' rust/crates/sdk/Cargo.toml | cut -d '"' -f2)
24+
TAG_VERSION=${GITHUB_REF#refs/tags/rust/chainlink-data-streams-sdk-v}
25+
if [ "$VERSION" != "$TAG_VERSION" ]; then
26+
echo "Version mismatch: Cargo.toml ($VERSION) != tag ($TAG_VERSION)"
27+
exit 1
28+
fi
29+
30+
- name: Publish chainlink-data-streams-sdk
31+
run: |
32+
cd rust/crates/sdk
33+
cargo publish --token ${CARGO_DATA_STREAMS_SDK}
34+
if ! cargo owner --list | grep -q "github:smartcontractkit:RustCrates"; then
35+
cargo owner --add github:smartcontractkit:RustCrates
36+
fi
37+
env:
38+
CARGO_DATA_STREAMS_SDK: ${{ secrets.CARGO_DATA_STREAMS_SDK }}

rust/crates/sdk/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "data-streams-sdk"
2+
name = "chainlink-data-streams-sdk"
33
version = "0.0.1"
44
edition = "2021"
55
rust-version = "1.70"
@@ -11,7 +11,7 @@ exclude = ["/target/*", "examples/*", "tests/*", "docs/*", "book/*"]
1111
keywords = ["chainlink"]
1212

1313
[dependencies]
14-
data-streams-report = { git = "https://github.com/smartcontractkit/data-streams-sdk.git", subdir = "rust/crates/report" }
14+
chainlink-data-streams-report = "0.0.1"
1515
reqwest = { version = "0.11.20", features = ["json", "rustls-tls"] }
1616
tokio = { version = "1.29.1", features = ["full"] }
1717
tokio-tungstenite = { version = "0.20.1", features = [

0 commit comments

Comments
 (0)