Skip to content

Commit 634a202

Browse files
authored
Crates.io publishing (#94)
1 parent 540739b commit 634a202

29 files changed

+111
-38
lines changed

.github/workflows/cargo_test.yml renamed to .github/workflows/ci.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Compile and Test
1+
name: CI
22

33
on:
44
push:
55
branches:
66
- master
7-
tags:
8-
- v*
97
pull_request:
8+
release:
9+
types: [published]
1010

1111
env:
1212
CARGO_TERM_COLOR: always
@@ -73,3 +73,30 @@ jobs:
7373
with:
7474
command: test
7575
args: --verbose --all-targets
76+
77+
publish:
78+
# Only do this job if publishing a release
79+
needs: build
80+
if: github.event_name == 'release' && github.event.action == 'published'
81+
runs-on: ubuntu-latest
82+
83+
steps:
84+
- name: Checkout repository
85+
uses: actions/checkout@v2
86+
87+
- name: Install toolchain
88+
uses: actions-rs/toolchain@v1
89+
with:
90+
toolchain: stable
91+
override: true
92+
93+
- name: Verify tag version
94+
run: |
95+
cargo install toml-cli
96+
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} fuel-client/Cargo.toml
97+
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} fuel-core/Cargo.toml
98+
99+
- name: Publish crate
100+
uses: katyo/publish-crates@v1
101+
with:
102+
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
err() {
5+
echo -e "\e[31m\e[1merror:\e[0m $@" 1>&2;
6+
}
7+
8+
status() {
9+
WIDTH=12
10+
printf "\e[32m\e[1m%${WIDTH}s\e[0m %s\n" "$1" "$2"
11+
}
12+
13+
REF=$1
14+
MANIFEST=$2
15+
16+
if [ -z "$REF" ]; then
17+
err "Expected ref to be set"
18+
exit 1
19+
fi
20+
21+
if [ -z "$MANIFEST" ]; then
22+
err "Expected manifest to be set"
23+
exit 1
24+
fi
25+
26+
# strip preceeding 'v' if it exists on tag
27+
REF=${REF/#v}
28+
TOML_VERSION=$(toml get $MANIFEST package.version | tr -d '"')
29+
30+
if [ "$TOML_VERSION" != "$REF" ]; then
31+
err "Crate version $TOML_VERSION, doesn't match tag version $REF"
32+
exit 1
33+
else
34+
status "Crate version matches tag $TOML_VERSION"
35+
fi

Cargo.lock

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

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Fuel Client
22

3+
[![build](https://github.com/FuelLabs/fuel-core/actions/workflows/ci.yml/badge.svg)](https://github.com/FuelLabs/fuel-core/actions/workflows/ci.yml)
4+
[![crates.io](https://img.shields.io/crates/v/fuel-core?label=latest)](https://crates.io/crates/fuel-core)
5+
[![docs](https://docs.rs/fuel-core/badge.svg)](https://docs.rs/fuel-core/)
6+
[![discord](https://img.shields.io/badge/chat%20on-discord-orange?&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/xfpK4Pe)
7+
38
Fuel client implementation.
49

510
## Testing
@@ -135,6 +140,6 @@ RET(REG_ONE),
135140
```
136141

137142
```
138-
$ cargo run --bin fuel-client -- transaction submit \
143+
$ cargo run --bin fuel-gql-cli -- transaction submit \
139144
"{\"Script\":{\"gas_price\":0,\"gas_limit\":1000000,\"maturity\":0,\"script\":[80,64,0,202,80,68,0,186,51,65,16,0,36,4,0,0],\"script_data\":[],\"inputs\":[],\"outputs\":[{\"Coin\":{\"to\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], \"amount\": 10, \"color\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}],\"witnesses\":[],\"receipts_root\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}"
140145
```

examples/simple-wasm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "simple-wasm"
33
version = "0.1.0"
44
edition = "2021"
5+
publish = false
56

67
[lib]
78
crate-type = ['cdylib']

fuel-client/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "fuel-client"
2+
name = "fuel-gql-client"
33
version = "0.1.0"
44
authors = ["Fuel Labs <contact@fuel.sh>"]
55
categories = ["concurrency", "cryptography::cryptocurrencies", "emulators"]
@@ -16,7 +16,7 @@ autotests = false
1616
autobenches = false
1717

1818
[[bin]]
19-
name = "fuel-client"
19+
name = "fuel-gql-cli"
2020
path = "src/main.rs"
2121

2222
[dependencies]
@@ -36,7 +36,7 @@ surf = "2.2"
3636
thiserror = "1.0"
3737

3838
[dev-dependencies]
39-
fuel-client = { path = ".", features = ["test-helpers"] }
39+
fuel-gql-client = { path = ".", features = ["test-helpers"] }
4040
fuel-core = { path = "../fuel-core", features = ["test-helpers"] }
4141
fuel-vm = { git = "ssh://git@github.com/FuelLabs/fuel-vm.git", features = ["serde-types", "random"] }
4242
insta = "1.8"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)