From 3c03fd0cceed66a44996176517d345f88923edf3 Mon Sep 17 00:00:00 2001 From: imotai Date: Tue, 13 Jun 2023 23:13:53 +0800 Subject: [PATCH 1/7] feat: add doc store --- Cargo.toml | 1 + src/proto/proto/db3_database_v2.proto | 108 ++++---------------------- src/proto/proto/db3_mutation_v2.proto | 2 +- src/storage/Cargo.toml | 2 + src/storage/src/db_store_v2.rs | 4 +- src/storage/src/lib.rs | 1 + 6 files changed, 20 insertions(+), 98 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a1aef40a0..95c2af42c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,5 @@ ethers = {git="https://github.com/imotai/ethers-rs", rev="d526191b7972e8cf4412fe tonic = {git="https://github.com/hyperium/tonic", rev="ae7580160431cd25c1eecda4c85014ef6ce8d93f"} tonic-web = {git="https://github.com/hyperium/tonic", rev="ae7580160431cd25c1eecda4c85014ef6ce8d93f"} arweave-rs = {git="https://github.com/imotai/arweave-rs", rev="7ac5027305db833e4d9b62c967309d5df8fba4f2"} +ejdb2rs = {git="https://github.com/imotai/ejdb2rs", rev="c937a085eda043bd854a0ef4d3e7bb63650610d1"} serde_json= "1.0" diff --git a/src/proto/proto/db3_database_v2.proto b/src/proto/proto/db3_database_v2.proto index dd8e015e3..6e42e2047 100644 --- a/src/proto/proto/db3_database_v2.proto +++ b/src/proto/proto/db3_database_v2.proto @@ -54,10 +54,22 @@ message EventTable { message Collection { bytes id = 1; string name = 2; - repeated Index index_list = 3; + repeated Index index_fields = 3; bytes sender = 4; } +enum IndexType { + UniqueKey = 0; + StringKey = 1; + Int64Key = 2; + DoubleKey = 3; +} + +message Index { + string path = 1; + IndexType index_type = 2; +} + message Document { bytes id = 1; bytes doc = 2; @@ -65,100 +77,6 @@ message Document { bytes tx_id = 4; } -message Index { - // A field in an index. - // The field_path describes which field is indexed, the value_mode describes - // how the field value is indexed. - message IndexField { - // The supported orderings. - enum Order { - // The ordering is unspecified. Not a valid option. - ORDER_UNSPECIFIED = 0; - - // The field is ordered by ascending field value. - ASCENDING = 1; - - // The field is ordered by descending field value. - DESCENDING = 2; - } - - // The supported array value configurations. - enum ArrayConfig { - // The index does not support additional array queries. - ARRAY_CONFIG_UNSPECIFIED = 0; - - // The index supports array containment queries. - CONTAINS = 1; - } - - // Can be __name__. - // For single field indexes, this must match the name of the field or may - // be omitted. - string field_path = 1; - - // How the field value is indexed. - oneof value_mode { - // Indicates that this field supports ordering by the specified order or - // comparing using =, !=, <, <=, >, >=. - Order order = 2; - - // Indicates that this field supports operations on `array_value`s. - ArrayConfig array_config = 3; - } - } - - // The state of an index. During index creation, an index will be in the - // `CREATING` state. If the index is created successfully, it will transition - // to the `READY` state. If the index creation encounters a problem, the index - // will transition to the `NEEDS_REPAIR` state. - enum State { - // The state is unspecified. - STATE_UNSPECIFIED = 0; - - // The index is being created. - // There is an active long-running operation for the index. - // The index is updated when writing a document. - // Some index data may exist. - CREATING = 1; - - // The index is ready to be used. - // The index is updated when writing a document. - // The index is fully populated from all stored documents it applies to. - READY = 2; - - // The index was being created, but something went wrong. - // There is no active long-running operation for the index, - // and the most recently finished long-running operation failed. - // The index is not updated when writing a document. - // Some index data may exist. - // Use the google.longrunning.Operations API to determine why the operation - // that last attempted to create this index failed, then re-create the - // index. - NEEDS_REPAIR = 3; - } - - // Output only. A server defined name for this index. - // The form of this name for composite indexes will be: - // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}` - // For single field indexes, this field will be empty. - string name = 1; - // Id of the index filed in the collection - uint32 id = 2; - - // The fields supported by this index. - // - // For composite indexes, this is always 2 or more fields. - // The last field entry is always for the field path `__name__`. If, on - // creation, `__name__` was not specified as the last field, it will be added - // automatically with the same direction as that of the last field defined. If - // the final field in a composite index is not directional, the `__name__` - // will be ordered ASCENDING (unless explicitly specified). - // - // For single field indexes, this will always be exactly one entry with a - // field path equal to the field path of the associated field. - repeated IndexField fields = 3; -} - // A Firestore query. message StructuredQuery { // A filter. diff --git a/src/proto/proto/db3_mutation_v2.proto b/src/proto/proto/db3_mutation_v2.proto index 4b303f139..926a71556 100644 --- a/src/proto/proto/db3_mutation_v2.proto +++ b/src/proto/proto/db3_mutation_v2.proto @@ -27,7 +27,7 @@ message DocumentDatabaseMutation { } message CollectionMutation { - repeated db3_database_v2_proto.Index index = 1; + repeated db3_database_v2_proto.Index index_fields = 1; string collection_name = 2; } diff --git a/src/storage/Cargo.toml b/src/storage/Cargo.toml index ea4a52ab2..c2312d224 100644 --- a/src/storage/Cargo.toml +++ b/src/storage/Cargo.toml @@ -35,3 +35,5 @@ timer = "0.2.0" arweave-rs = {workspace=true} url = "2.4.0" http = "0.2" +moka = "0.11.2" +ejdb2rs = {workspace=true} diff --git a/src/storage/src/db_store_v2.rs b/src/storage/src/db_store_v2.rs index 22cc07a1a..74f2cf2ea 100644 --- a/src/storage/src/db_store_v2.rs +++ b/src/storage/src/db_store_v2.rs @@ -219,7 +219,7 @@ impl DBStoreV2 { let col = Collection { id: id.as_ref().to_vec(), name: collection.collection_name.to_string(), - index_list: collection.index.to_vec(), + index_fields: collection.index_fields.to_vec(), sender: sender.as_ref().to_vec(), }; let mut buf = BytesMut::with_capacity(1024); @@ -338,7 +338,7 @@ mod tests { assert!(false); } let collection = CollectionMutation { - index: vec![], + index_fields: vec![], collection_name: "col1".to_string(), }; let result = diff --git a/src/storage/src/lib.rs b/src/storage/src/lib.rs index 6caf8e518..80c6512e1 100644 --- a/src/storage/src/lib.rs +++ b/src/storage/src/lib.rs @@ -26,6 +26,7 @@ pub mod db_owner_key; pub mod db_owner_key_v2; pub mod db_store; pub mod db_store_v2; +pub mod doc_store; pub mod key; pub mod mutation_store; pub mod state_store; From 1b143719266e986fcbb68ad295d33c1cb1318c0d Mon Sep 17 00:00:00 2001 From: imotai Date: Fri, 28 Jul 2023 16:35:22 +0800 Subject: [PATCH 2/7] fix: add test case --- src/node/src/rollup_executor.rs | 2 ++ src/storage/src/meta_store_client.rs | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/node/src/rollup_executor.rs b/src/node/src/rollup_executor.rs index 878e6cb9c..9dc12a64c 100644 --- a/src/node/src/rollup_executor.rs +++ b/src/node/src/rollup_executor.rs @@ -303,10 +303,12 @@ impl RollupExecutor { network_id, ) .await?; + let (evm_cost, tx_hash) = meta_store .update_rollup_step(id.as_str(), network_id) .await?; let tx_str = format!("0x{}", hex::encode(tx_hash.as_bytes())); + info!("the process rollup done with num mutations {num_rows}, raw data size {memory_size}, compress data size {size} and processed time {} id {} ar cost {} and evm tx {} and cost {}", now.elapsed().as_secs(), id.as_str(), reward, tx_str.as_str(), diff --git a/src/storage/src/meta_store_client.rs b/src/storage/src/meta_store_client.rs index f6657b42b..0cd995d5d 100644 --- a/src/storage/src/meta_store_client.rs +++ b/src/storage/src/meta_store_client.rs @@ -79,6 +79,7 @@ impl MetaStoreClient { .map_err(|e| DB3Error::StoreEventError(format!("fail to register data network {e}")))?; Ok(()) } + pub async fn create_database(&self, network: u64, desc: &str) -> Result<(U256, TxHash)> { let store = DB3MetaStore::new(self.address, self.client.clone()); let desc_bytes = desc.as_bytes(); @@ -195,6 +196,30 @@ mod tests { use super::*; use fastcrypto::encoding::{Base64, Encoding}; use tokio::time::{sleep, Duration as TokioDuration}; + + #[tokio::test] + async fn register_scroll_data_network() { + let data = hex::decode("ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80") + .unwrap(); + let data_ref: &[u8] = data.as_ref(); + let wallet = LocalWallet::from_bytes(data_ref).unwrap(); + let wallet = wallet.with_chain_id(31337_u32); + let rollup_node_address = wallet.address(); + let contract_addr = "0x5fbdb2315678afecb367f032d93f642f64180aa3"; + let rpc_url = "ws://127.0.0.1:8545"; + sleep(TokioDuration::from_millis(10 * 1000)).await; + let client = MetaStoreClient::new(contract_addr, rpc_url, wallet) + .await + .unwrap(); + let result = client + .register_data_network(&rollup_node_address, rpc_url) + .await; + assert!(result.is_ok(), "register data network failed {:?}", result); + sleep(TokioDuration::from_millis(5 * 1000)).await; + + + } + #[tokio::test] async fn register_no1_data_network() { let data = hex::decode("ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80") From 51b5bad60684db99e93a7b00a4e30567f9f8a151 Mon Sep 17 00:00:00 2001 From: imotai Date: Fri, 28 Jul 2023 17:45:32 +0800 Subject: [PATCH 3/7] fix: add use legacy tx --- src/node/src/command.rs | 7 ++ src/node/src/node_test_base.rs | 1 + src/node/src/recover.rs | 3 +- src/node/src/rollup_executor.rs | 19 ++++- src/node/src/storage_node_light_impl.rs | 1 + src/storage/src/meta_store_client.rs | 101 +++++++++++++++--------- thirdparty/data-manager | 2 +- 7 files changed, 89 insertions(+), 45 deletions(-) diff --git a/src/node/src/command.rs b/src/node/src/command.rs index e170ba37d..5f6c2274b 100644 --- a/src/node/src/command.rs +++ b/src/node/src/command.rs @@ -104,6 +104,9 @@ pub enum DB3Command { /// this is just for upgrade the node #[clap(long, default_value = "100000")] doc_id_start: i64, + /// use the legacy transaction format + #[clap(long, default_value = "false")] + use_legacy_tx: bool, }, /// Start the data index node @@ -241,6 +244,7 @@ impl DB3Command { key_root_path, admin_addr, doc_id_start, + use_legacy_tx, } => { let log_level = if verbose { LevelFilter::DEBUG @@ -261,6 +265,7 @@ impl DB3Command { key_root_path.as_str(), admin_addr.as_str(), doc_id_start, + use_legacy_tx, ) .await; let running = Arc::new(AtomicBool::new(true)); @@ -479,11 +484,13 @@ impl DB3Command { key_root_path: &str, admin_addr: &str, doc_start_id: i64, + use_legacy_tx: bool, ) { let listen_addr = format!("{bind_host}:{listening_port}"); let rollup_config = RollupExecutorConfig { temp_data_path: rollup_data_path.to_string(), key_root_path: key_root_path.to_string(), + use_legacy_tx, }; let store_config = MutationStoreConfig { diff --git a/src/node/src/node_test_base.rs b/src/node/src/node_test_base.rs index f96ba4960..b5d977439 100644 --- a/src/node/src/node_test_base.rs +++ b/src/node/src/node_test_base.rs @@ -59,6 +59,7 @@ pub mod tests { let rollup_config = RollupExecutorConfig { temp_data_path: format!("{real_path}/rollup_data_path"), key_root_path: key_root_path.to_string(), + use_legacy_tx: false, }; if let Err(_e) = std::fs::create_dir_all(rollup_config.temp_data_path.as_str()) { println!("create dir error"); diff --git a/src/node/src/recover.rs b/src/node/src/recover.rs index 7c25cf175..cf032dc21 100644 --- a/src/node/src/recover.rs +++ b/src/node/src/recover.rs @@ -69,7 +69,8 @@ impl Recover { format!("0x{}", hex::encode(wallet.address().as_bytes())) ); let meta_store = Arc::new( - MetaStoreClient::new(contract_addr.as_str(), evm_node_url.as_str(), wallet).await?, + MetaStoreClient::new(contract_addr.as_str(), evm_node_url.as_str(), wallet, false) + .await?, ); let ar_fs_config = ArFileSystemConfig { arweave_url: ar_node_url, diff --git a/src/node/src/rollup_executor.rs b/src/node/src/rollup_executor.rs index 9dc12a64c..24f97a039 100644 --- a/src/node/src/rollup_executor.rs +++ b/src/node/src/rollup_executor.rs @@ -36,6 +36,7 @@ use tracing::{info, warn}; // Workaround to use prinltn! for logs. pub struct RollupExecutorConfig { pub temp_data_path: String, pub key_root_path: String, + pub use_legacy_tx: bool, } pub struct RollupExecutor { @@ -71,8 +72,13 @@ impl RollupExecutor { let wallet = system_store.get_evm_wallet(c.chain_id)?; let min_rollup_size = c.min_rollup_size; let meta_store = ArcSwapOption::from(Some(Arc::new( - MetaStoreClient::new(c.contract_addr.as_str(), c.evm_node_url.as_str(), wallet) - .await?, + MetaStoreClient::new( + c.contract_addr.as_str(), + c.evm_node_url.as_str(), + wallet, + config.use_legacy_tx, + ) + .await?, ))); let ar_fs_config = ArFileSystemConfig { arweave_url: c.ar_node_url.clone(), @@ -134,8 +140,13 @@ impl RollupExecutor { self.rollup_max_interval .store(c.rollup_max_interval, Ordering::Relaxed); let meta_store = Some(Arc::new( - MetaStoreClient::new(c.contract_addr.as_str(), c.evm_node_url.as_str(), wallet) - .await?, + MetaStoreClient::new( + c.contract_addr.as_str(), + c.evm_node_url.as_str(), + wallet, + self.config.use_legacy_tx, + ) + .await?, )); self.min_gc_round_offset .store(c.min_gc_offset, Ordering::Relaxed); diff --git a/src/node/src/storage_node_light_impl.rs b/src/node/src/storage_node_light_impl.rs index 35b5bbef6..6a1b770f3 100644 --- a/src/node/src/storage_node_light_impl.rs +++ b/src/node/src/storage_node_light_impl.rs @@ -718,6 +718,7 @@ mod tests { let rollup_config = RollupExecutorConfig { temp_data_path: format!("{real_path}/data_path"), key_root_path: format!("{real_path}/keys"), + use_legacy_tx: false, }; let system_store_config = SystemStoreConfig { diff --git a/src/storage/src/meta_store_client.rs b/src/storage/src/meta_store_client.rs index 0cd995d5d..c00093f50 100644 --- a/src/storage/src/meta_store_client.rs +++ b/src/storage/src/meta_store_client.rs @@ -34,13 +34,19 @@ abigen!(Events, "abi/Events.json"); pub struct MetaStoreClient { address: Address, client: Arc>>, LocalWallet>>, + use_legacy_tx: bool, } unsafe impl Sync for MetaStoreClient {} unsafe impl Send for MetaStoreClient {} impl MetaStoreClient { - pub async fn new(contract_addr: &str, rpc_url: &str, wallet: LocalWallet) -> Result { + pub async fn new( + contract_addr: &str, + rpc_url: &str, + wallet: LocalWallet, + use_legacy_tx: bool, + ) -> Result { let address = contract_addr .parse::
() .map_err(|_| DB3Error::InvalidAddress)?; @@ -51,7 +57,11 @@ impl MetaStoreClient { let provider_arc = Arc::new(provider); let signable_client = SignerMiddleware::new(provider_arc, wallet); let client = Arc::new(signable_client); - Ok(Self { address, client }) + Ok(Self { + address, + client, + use_legacy_tx, + }) } pub async fn register_data_network( @@ -74,9 +84,18 @@ impl MetaStoreClient { empty_index_addresses, desc, ); - tx.send() - .await - .map_err(|e| DB3Error::StoreEventError(format!("fail to register data network {e}")))?; + match self.use_legacy_tx { + true => { + tx.legacy().send().await.map_err(|e| { + DB3Error::StoreEventError(format!("fail to register data network {e}")) + })?; + } + false => { + tx.send().await.map_err(|e| { + DB3Error::StoreEventError(format!("fail to register data network {e}")) + })?; + } + } Ok(()) } @@ -89,12 +108,25 @@ impl MetaStoreClient { let mut desc_bytes32: [u8; 32] = Default::default(); desc_bytes32[..desc_bytes.len()].clone_from_slice(desc_bytes); let tx = store.create_doc_database(network.into(), desc_bytes32); - let pending_tx = tx.send().await.map_err(|e| { - DB3Error::StoreEventError(format!( - "fail to send create doc database request with error {e}" - )) - })?; - let tx_hash = pending_tx.tx_hash(); + let tx_hash = match self.use_legacy_tx { + true => { + let tx = tx.legacy(); + let pending_tx = tx.send().await.map_err(|e| { + DB3Error::StoreEventError(format!( + "fail to send create doc database request with error {e}" + )) + })?; + pending_tx.tx_hash() + } + false => { + let pending_tx = tx.send().await.map_err(|e| { + DB3Error::StoreEventError(format!( + "fail to send create doc database request with error {e}" + )) + })?; + pending_tx.tx_hash() + } + }; let mut count_down: i32 = 5; loop { if count_down <= 0 { @@ -160,11 +192,25 @@ impl MetaStoreClient { ar_tx, network ); let tx = store.update_rollup_steps(network_id, ar_tx_binary); - //TODO set gas limit - let pending_tx = tx.send().await.map_err(|e| { - DB3Error::StoreEventError(format!("fail to send update rollup request with error {e}")) - })?; - let tx_hash = pending_tx.tx_hash(); + let tx_hash = match self.use_legacy_tx { + true => { + let tx = tx.legacy(); + let pending_tx = tx.send().await.map_err(|e| { + DB3Error::StoreEventError(format!( + "fail to send create doc database request with error {e}" + )) + })?; + pending_tx.tx_hash() + } + false => { + let pending_tx = tx.send().await.map_err(|e| { + DB3Error::StoreEventError(format!( + "fail to send create doc database request with error {e}" + )) + })?; + pending_tx.tx_hash() + } + }; info!("update rollup step done! tx hash: {}", tx_hash); let mut count_down: i32 = 5; loop { @@ -197,29 +243,6 @@ mod tests { use fastcrypto::encoding::{Base64, Encoding}; use tokio::time::{sleep, Duration as TokioDuration}; - #[tokio::test] - async fn register_scroll_data_network() { - let data = hex::decode("ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80") - .unwrap(); - let data_ref: &[u8] = data.as_ref(); - let wallet = LocalWallet::from_bytes(data_ref).unwrap(); - let wallet = wallet.with_chain_id(31337_u32); - let rollup_node_address = wallet.address(); - let contract_addr = "0x5fbdb2315678afecb367f032d93f642f64180aa3"; - let rpc_url = "ws://127.0.0.1:8545"; - sleep(TokioDuration::from_millis(10 * 1000)).await; - let client = MetaStoreClient::new(contract_addr, rpc_url, wallet) - .await - .unwrap(); - let result = client - .register_data_network(&rollup_node_address, rpc_url) - .await; - assert!(result.is_ok(), "register data network failed {:?}", result); - sleep(TokioDuration::from_millis(5 * 1000)).await; - - - } - #[tokio::test] async fn register_no1_data_network() { let data = hex::decode("ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80") diff --git a/thirdparty/data-manager b/thirdparty/data-manager index 7ee45ae8d..e982f03ee 160000 --- a/thirdparty/data-manager +++ b/thirdparty/data-manager @@ -1 +1 @@ -Subproject commit 7ee45ae8d3cf19b50af9b40b94138ae7ce9f692a +Subproject commit e982f03ee70588c671f10cceb19408fcb0e947e6 From b7cf3fcb4a0acc35004ec0e8eabf0aca1e07e1f1 Mon Sep 17 00:00:00 2001 From: imotai Date: Fri, 28 Jul 2023 17:53:07 +0800 Subject: [PATCH 4/7] fix: update the readme --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 688ee0219..8232d216c 100644 --- a/README.md +++ b/README.md @@ -83,16 +83,19 @@ if you have any questions, please feel free to ask us for help and you can find * the doc about [queryDoc](https://docs.db3.network/functions/queryDoc.html) -# Try Our Cloud Sandbox +# Try the testnet -* [Console](https://console.cloud.db3.network/console/home):https://console.cloud.db3.network/console/home -* Data Rollup Node: https://rollup.cloud.db3.network -* Data Index Node: https://index.cloud.db3.network -You can connect to the Data Rollup Node and Data Index Node with db3.js +| Public Chains | Testnet | Mainnet | +|----------|:-------------:|:------:| +| zksync |data rollup node:`https://zksync.rollup.testnet.db3.network`
data index node:`https://zksync.index.testnet.db3.network` | :soon: | +| scroll |data rollup node:`https://scroll.rollup.testnet.db3.network`
data index node:`https://scroll.index.testnet.db3.network` | :soon: | + +You can connect to the Data Rollup Node and Data Index Node with db3.js Note: the cloud sandbox is just for testing and unstable + # How it works The DB3 Network has two roles: From 34abedf0535051ac45c30a6e0835f417eab9b01d Mon Sep 17 00:00:00 2001 From: imotai Date: Fri, 28 Jul 2023 19:11:56 +0800 Subject: [PATCH 5/7] fix: fix the metastore case --- src/storage/src/meta_store_client.rs | 4 ++-- thirdparty/data-manager | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/storage/src/meta_store_client.rs b/src/storage/src/meta_store_client.rs index c00093f50..83d47b0a8 100644 --- a/src/storage/src/meta_store_client.rs +++ b/src/storage/src/meta_store_client.rs @@ -254,7 +254,7 @@ mod tests { let contract_addr = "0x5fbdb2315678afecb367f032d93f642f64180aa3"; let rpc_url = "ws://127.0.0.1:8545"; sleep(TokioDuration::from_millis(10 * 1000)).await; - let client = MetaStoreClient::new(contract_addr, rpc_url, wallet) + let client = MetaStoreClient::new(contract_addr, rpc_url, wallet, false) .await .unwrap(); let result = client @@ -274,7 +274,7 @@ mod tests { let rollup_node_address = wallet.address(); let contract_addr = "0x5FbDB2315678afecb367f032d93F642f64180aa3"; let rpc_url = "ws://127.0.0.1:8545"; - let client = MetaStoreClient::new(contract_addr, rpc_url, wallet) + let client = MetaStoreClient::new(contract_addr, rpc_url, wallet, false) .await .unwrap(); let result = client diff --git a/thirdparty/data-manager b/thirdparty/data-manager index e982f03ee..c67f0775e 160000 --- a/thirdparty/data-manager +++ b/thirdparty/data-manager @@ -1 +1 @@ -Subproject commit e982f03ee70588c671f10cceb19408fcb0e947e6 +Subproject commit c67f0775e39b1f0aaadfc69d2273210d62f125b1 From e0a43b11931cdc9d20ce6289ac9e0090f5107749 Mon Sep 17 00:00:00 2001 From: imotai Date: Fri, 28 Jul 2023 19:19:56 +0800 Subject: [PATCH 6/7] fix: add update the npm version --- .github/workflows/sdk_cd.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sdk_cd.yml b/.github/workflows/sdk_cd.yml index baea5dad7..0b29edd02 100644 --- a/.github/workflows/sdk_cd.yml +++ b/.github/workflows/sdk_cd.yml @@ -17,7 +17,10 @@ jobs: node-version: "16.x" - uses: CultureHQ/actions-yarn@v1.0.1 - run: | - cd sdk && yarn && make && yarn build + TAG=${GITHUB_REF/refs\/tags\//} + VERSION=${TAG#*v} + echo ${VERSION} + cd sdk && yarn version --new-version ${VERSION} && yarn && make && yarn build - uses: JS-DevTools/npm-publish@v2 with: token: ${{ secrets.NMP_TOKEN }} From 4227ed1d0cab506ff3e9adf57e64a6d16aaa8c07 Mon Sep 17 00:00:00 2001 From: imotai Date: Fri, 28 Jul 2023 19:28:34 +0800 Subject: [PATCH 7/7] fix: fix the release sdk bug --- .github/workflows/sdk_cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sdk_cd.yml b/.github/workflows/sdk_cd.yml index 0b29edd02..da9196ff8 100644 --- a/.github/workflows/sdk_cd.yml +++ b/.github/workflows/sdk_cd.yml @@ -15,8 +15,8 @@ jobs: - uses: actions/setup-node@v3.7.0 with: node-version: "16.x" - - uses: CultureHQ/actions-yarn@v1.0.1 - - run: | + - name: build sdk + run: | TAG=${GITHUB_REF/refs\/tags\//} VERSION=${TAG#*v} echo ${VERSION}