Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
feat(scripts): introduce update-readme.sh (#53)
Browse files Browse the repository at this point in the history
* feat(scripts): introduce update-readme.sh

* ci(release): test secrets

* ci(release): use inline token in cargo publish

* ci(release): re-enable realease on pr for testing

* ci(release): fix the naming of secret

* bumps(v0.1.4): fix build.rs for docs.rs
  • Loading branch information
clearloop authored Sep 1, 2022
1 parent f53876b commit 5729c62
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 1 * *'
- cron: '0 0 * * *'

jobs:
build_and_tests:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
publish:
name: Publish new version on crate.io
name: crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -21,7 +21,5 @@ jobs:

- name: Publish
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: |
cargo login "$CRATES_IO_TOKEN"
cargo publish -v --all-features
TOKEN: ${{ secrets.CRATES_IO_SECRET }}
run: cargo publish --token "$TOKEN" --all-features
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gear-program"
version = "0.1.3"
version = "0.1.4"
authors = ["clearloop <[email protected]>"]
edition = "2021"
description = "gear program cli"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Usages:

```sh
$ gear
gear-program 0.1.3
gear-program 0.1.4

USAGE:
gear [FLAGS] [OPTIONS] <SUBCOMMAND>
Expand Down
30 changes: 0 additions & 30 deletions build.rs

This file was deleted.

1 change: 1 addition & 0 deletions scripts/generate-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function generate-header() {
//!
//! spec_version: $1
#![allow(clippy::all)]
#![allow(missing_docs)]
EOF
}

Expand Down
17 changes: 17 additions & 0 deletions scripts/update-readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
#
# Inject `README.md` into `src/lib.rs`
readonly ROOT_DIR="$(cd "$(dirname "$0")"/.. && pwd)"
readonly README="${ROOT_DIR}/README.md"
readonly LIB_RS="${ROOT_DIR}/src/lib.rs"

#########################################
# Conact `README.md` and `src/lib.rs`
############################################
function main() {
readme=$(cat ${README} | sed 's/^/\/\/\!/' | sed 's/\!\(\S\)/\! \1/')
lib_rs=$(cat ${LIB_RS} | sed '/\/\/\!/c\')
echo -e "${readme}\n${lib_rs}" > "${LIB_RS}"
}

main
1 change: 1 addition & 0 deletions src/api/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//!
//! spec_version: 1670
#![allow(clippy::all)]
#![allow(missing_docs)]
#[allow(dead_code, unused_imports, non_camel_case_types)]
pub mod api {
use super::api as root_mod;
Expand Down
151 changes: 75 additions & 76 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
//!# gear-program
//! # gear-program
//!
//![![CI][ci1]][ci2]
//![![crates.io][c1]][c2]
//![![docs][docs1]][docs2]
//![![downloads][d1]][d2]
//![![License][l1]][l2]
//! [![CI][ci1]][ci2]
//! [![crates.io][c1]][c2]
//! [![docs][docs1]][docs2]
//! [![downloads][d1]][d2]
//! [![License][l1]][l2]
//!
//![c1]: https://img.shields.io/crates/v/gear-program.svg
//![c2]: https://crates.io/crates/gear-program
//! [c1]: https://img.shields.io/crates/v/gear-program.svg
//! [c2]: https://crates.io/crates/gear-program
//!
//![ci1]: https://github.com/clearloop/gear-program/workflows/CI/badge.svg
//![ci2]: https://github.com/clearloop/gear-program/actions/workflows/CI.yaml
//! [ci1]: https://github.com/clearloop/gear-program/workflows/CI/badge.svg
//! [ci2]: https://github.com/clearloop/gear-program/actions/workflows/CI.yaml
//!
//![docs1]: https://img.shields.io/badge/current-docs-brightgreen.svg
//![docs2]: https://docs.rs/gear-program/
//! [docs1]: https://img.shields.io/badge/current-docs-brightgreen.svg
//! [docs2]: https://docs.rs/gear-program/
//!
//![d1]: https://img.shields.io/crates/d/gear-program.svg
//![d2]: https://crates.io/crates/gear-program
//! [d1]: https://img.shields.io/crates/d/gear-program.svg
//! [d2]: https://crates.io/crates/gear-program
//!
//![l1]: https://img.shields.io/badge/License-GPL%203.0-success
//![l2]: https://github.com/clearloop/gear-program/blob/master/LICENSE
//! [l1]: https://img.shields.io/badge/License-GPL%203.0-success
//! [l2]: https://github.com/clearloop/gear-program/blob/master/LICENSE
//!
//!
//!## Getting Started
//! ## Getting Started
//!
//!To install gear-program via <kbd>cargo</kbd>
//! To install gear-program via <kbd>cargo</kbd>
//!
//!```sh
//!$ cargo install gear-program
//!```
//! ```sh
//! $ cargo install gear-program
//! ```
//!
//!Usages:
//! Usages:
//!
//!```sh
//!$ gear
//!gear-program 0.1.3
//! ```sh
//! $ gear
//! gear-program 0.1.3
//!
//!USAGE:
//! USAGE:
//! gear [FLAGS] [OPTIONS] <SUBCOMMAND>
//!
//!FLAGS:
//! FLAGS:
//! -h, --help Prints help information
//! -V, --version Prints version information
//! -v, --verbose Enable verbose logs
//!
//!OPTIONS:
//! OPTIONS:
//! -e, --endpoint <endpoint> Gear node rpc endpoint
//! -p, --passwd <passwd> Password of the signer account
//!
//!SUBCOMMANDS:
//! SUBCOMMANDS:
//! claim Claim value from mailbox
//! create Deploy program to gear node
//! help Prints this message or the help of the given subcommand(s)
Expand All @@ -63,53 +63,52 @@
//! transfer Transfer value
//! update Update self from crates.io or github
//! upload Saves program `code` in storage
//!```
//!
//!Now, let's create a <kbd>new</kbd> gear program and upload it to the staging testnet!
//!
//!```sh
//!$ gear new hello-world
//!Cloning into '/home/clearloop/.gear/apps'...
//!remote: Enumerating objects: 156, done.
//!remote: Counting objects: 100% (156/156), done.
//!remote: Compressing objects: 100% (121/121), done.
//!remote: Total 156 (delta 41), reused 83 (delta 15), pack-reused 0
//!Receiving objects: 100% (156/156), 89.78 KiB | 723.00 KiB/s, done.
//!Resolving deltas: 100% (41/41), done.
//!Successfully created registry at /home/clearloop/.gear/apps!
//!Successfully created hello-world!
//!```
//!
//!Compile you gear program via <kbd>cargo</kbd>
//!
//!```sh
//!$ cargo build --manifest-path hello-world/Cargo.toml --release
//!```
//!
//!<kbd>login</kbd> to your gear account
//!
//!```sh
//!$ gear login //Alice
//!Successfully logged in as 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY!
//!```
//!
//!<kbd>upload</kbd> your gear program
//!
//!```sh
//!$ gear upload hello-world/target/wasm32-unknown-unknown/release/hello_world.wasm
//![INFO ] Submited extrinsic Gear::upload_code
//![INFO ] Status: Ready
//![INFO ] Status: Broadcast( ["12D3KooWQbJXFeRDJqmLT6jqahsJpwKGL5xEJJ6F3tevR1R85Upz", "12D3KooWFwZEE7cVz7fPTUrekv2Xfv2sR5HMetpadw4W9fZnEBr5", "12D3KooWNmeoxqMTSc3CzeA5SLTQ6xYQo4yz3Az1zjnAqrhpmBSH", "12D3KooWLFN7AceaViuVDakKghwLVo9i91Bi8DLyf1BGg6ftVGnG", "12D3KooWJ9EASqU3T89z1EBYMnvfTh5WK4Rgw3RMensrx5STRvXR", "12D3KooWDuzvhmTAebZXGJG8SCurHkn9x6mmpiTSQygGoCvXmYmU", "12D3KooWH7QBPHh5Byc2ZBjGSiqBbGzBAr5E8mqLWueyPXQJrxWB", "12D3KooWRw1Yfdo86zpgN9TTLJ6J53iAM1y1PW9ogKHsTHvBPDg9", "12D3KooWJ15sMWcCgmSLBAfRD5TZgKoCCZ1xDzPRGzbR2YC5zKqS", "12D3KooWEMDPU47VnnZPLEMXeFJkphaG8kRdn9SuTqoJJEhrwC2w", "12D3KooWSfMsGDWG6hvTgfLoFETZrnxNC649bQwSa9FxTAPw4Cmy", "12D3KooWK7fw8MdENES5jAb8kjLw4b3eGMxuWBPR52v15FRkmYF3", "12D3KooWLP3AxJf1VfVJzbzcrHAkipXXa9bSvPcE1TowuRQZE8bz", "12D3KooWSf2d69w7RYKtj9mgYpLDs3rqLAz9GHNSHHoCQDLUjeiP", "12D3KooWSKMmTordwL3t6SkQaKXuXt1aYC2QZAXNyt8DxjpgFXYq", "12D3KooWEsvboSEFhf5utCZJ4gfUjb7S5i9Qec1TXB2DuYPJZVzB", "12D3KooWRf7vAr79yAyDxGvYAdSqhh2EoeWe35Lx4QH4N6XMv2gH", "12D3KooWPuaSwvwq2EGdasjJruUzR1wwTk1tDdVBZauKwG8ZPFi1", "12D3KooWHSepUMWdNVgKPhdquR12AzSZrkHwUsfXvVfFMPGXpyH5", "12D3KooWDC3qNpRz5LdSfPWi3XWfc7kG5GHyEDNR2NcgJMedfu5v", "12D3KooWRQ8oUwhrW84UuVpQNZ2QxS2kg3SyhLwVkwHHk9vJgf5q", "12D3KooWHZaCXaMgavJYoH925jiLrLhsbPpU14tt6M7ypenDyfPc", "12D3KooWAd4GWfAqNTqoqTNnjsKqJHWNRezgcHi742eGYKDdYsfC", "12D3KooWFWc6NFCiuTxd9iKq9mi1n3G7nBEZ5yDkzzHjkGBSceje", "12D3KooWQ8yjECbzLThEwzcTQ3gtVgZbb1XPBrPyHnRkmLJRGfEW", "12D3KooWFsZdJERxRrc5afrFDxvts4bDxSHHDgQxh8bTm4Kq9PV7", "12D3KooWGpxgFFTXij8gXzx6YgExaVczUN2fuohccrkA11tGFzDu", "12D3KooWND9qfwCVtfB17y9fcThBKoWvCSpXrCQCs6XsWvHE5om2", "12D3KooWLoCosNXv1HESuU76r7xmp5UU4pdCncnZXB1hYvcbCYgX", "12D3KooWEga7tssCYmywnRU492ANXV4vGYqX5AVJrrAAKQ1zhhGN", "12D3KooWDP1pb16iGikYc8fkkL8ZYmzPqsrVRzQHHBDKxjRpUMNA", "12D3KooWG26t3Z1NfeAPNWdwrdWYntSUj69LzHcnBdV4PcQMEuHA", "12D3KooWS5DUgYPSQVrexXbPksR4cVsexFhLXzXFgsY47ZPeFHd9", "12D3KooWBWFtZqigVTC8W2GRMwLeuTK2o4hDC4XHVPyNV6hW1T1D", "12D3KooWDCboxcE7VAB3v3UJf1hrNZiswyk5Eg1u2kaiSs4v6Sbi", "12D3KooWNx1mbmwKXSPS8vuHkyVrQrZnwp4HGjLczPxFCpAyRhNS", "12D3KooWJ3KhEHCm4roQw2LAUGu28fXJf5QqQHhG6EaACw6RCUjr", "12D3KooWFnr5yyEcNAfdjJjfuBAMaZ2iz3GLyFrJAs5AiRJ74vWS", "12D3KooWMNeo7UgreqFxQ6BstVgZrNAZMVyKt9EWnC6AD9J2M1rT", "12D3KooWEVvqVD2mrLfmgeX1EXZ2caFXXEWWEs4Taa4mWzFUoF34", "12D3KooWMadAihMmvZmGt1HpxGAqqjb7Q2q96VVev6rGA1GLuqjv", "12D3KooWARM6duzRRd64fMJZJY3VqWekeG1rmJqxxjNLRYaQVPRt", "12D3KooWSqCyNpmVwaAxS1mMms2GQvUcPzPdoWB2XjiWpXvGW3Jf", "12D3KooWH22kTRSvhRnMUtu7Eg8d96Ma68jzRKV7vtxVMwB96kvS", "12D3KooWN1LBk84vnJEsQ33WsPRvpSzfrNMUZ2iLhTkUYjsSfwR5", "12D3KooWMxtE2fWGZZsZjfjoRN5aH6ecSKj8YfTkufi2vtywoKLS", "12D3KooWGMpAqtwpGR4tcQ3tc2ZThkTUN2YYcgxQsuSbfdQ4h3E4", "12D3KooWSyBLw12Z8rHRx2NSAfmb3cpAP6nJ2qK5FkdEC38zNVKk", "12D3KooWH7sqE4cp9wyLt5Z7xzuqA2imNGMeUHnu2gPJ4hGnJqJv", "12D3KooWK896roWsGutzksP9cZc3oypVPjRB1o83uHzjxM72V7zb"] )
//![INFO ] Status: InBlock( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 )
//![INFO ] Status: Finalized( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 )
//![INFO ] Successfully submited call Gear::upload_code 0x2c54…e9d9 at 0x4409…fa04!
//![INFO ] Balance spent: 3724868714
//!```
//!
//!## LICENSE
//!
//!GPL v3.0
// <END_OF_README>
//! ```
//!
//! Now, let's create a <kbd>new</kbd> gear program and upload it to the staging testnet!
//!
//! ```sh
//! $ gear new hello-world
//! Cloning into '/home/clearloop/.gear/apps'...
//! remote: Enumerating objects: 156, done.
//! remote: Counting objects: 100% (156/156), done.
//! remote: Compressing objects: 100% (121/121), done.
//! remote: Total 156 (delta 41), reused 83 (delta 15), pack-reused 0
//! Receiving objects: 100% (156/156), 89.78 KiB | 723.00 KiB/s, done.
//! Resolving deltas: 100% (41/41), done.
//! Successfully created registry at /home/clearloop/.gear/apps!
//! Successfully created hello-world!
//! ```
//!
//! Compile you gear program via <kbd>cargo</kbd>
//!
//! ```sh
//! $ cargo build --manifest-path hello-world/Cargo.toml --release
//! ```
//!
//! <kbd>login</kbd> to your gear account
//!
//! ```sh
//! $ gear login //Alice
//! Successfully logged in as 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY!
//! ```
//!
//! <kbd>upload</kbd> your gear program
//!
//! ```sh
//! $ gear upload hello-world/target/wasm32-unknown-unknown/release/hello_world.wasm
//! [INFO ] Submited extrinsic Gear::upload_code
//! [INFO ] Status: Ready
//! [INFO ] Status: Broadcast( ["12D3KooWQbJXFeRDJqmLT6jqahsJpwKGL5xEJJ6F3tevR1R85Upz", "12D3KooWFwZEE7cVz7fPTUrekv2Xfv2sR5HMetpadw4W9fZnEBr5", "12D3KooWNmeoxqMTSc3CzeA5SLTQ6xYQo4yz3Az1zjnAqrhpmBSH", "12D3KooWLFN7AceaViuVDakKghwLVo9i91Bi8DLyf1BGg6ftVGnG", "12D3KooWJ9EASqU3T89z1EBYMnvfTh5WK4Rgw3RMensrx5STRvXR", "12D3KooWDuzvhmTAebZXGJG8SCurHkn9x6mmpiTSQygGoCvXmYmU", "12D3KooWH7QBPHh5Byc2ZBjGSiqBbGzBAr5E8mqLWueyPXQJrxWB", "12D3KooWRw1Yfdo86zpgN9TTLJ6J53iAM1y1PW9ogKHsTHvBPDg9", "12D3KooWJ15sMWcCgmSLBAfRD5TZgKoCCZ1xDzPRGzbR2YC5zKqS", "12D3KooWEMDPU47VnnZPLEMXeFJkphaG8kRdn9SuTqoJJEhrwC2w", "12D3KooWSfMsGDWG6hvTgfLoFETZrnxNC649bQwSa9FxTAPw4Cmy", "12D3KooWK7fw8MdENES5jAb8kjLw4b3eGMxuWBPR52v15FRkmYF3", "12D3KooWLP3AxJf1VfVJzbzcrHAkipXXa9bSvPcE1TowuRQZE8bz", "12D3KooWSf2d69w7RYKtj9mgYpLDs3rqLAz9GHNSHHoCQDLUjeiP", "12D3KooWSKMmTordwL3t6SkQaKXuXt1aYC2QZAXNyt8DxjpgFXYq", "12D3KooWEsvboSEFhf5utCZJ4gfUjb7S5i9Qec1TXB2DuYPJZVzB", "12D3KooWRf7vAr79yAyDxGvYAdSqhh2EoeWe35Lx4QH4N6XMv2gH", "12D3KooWPuaSwvwq2EGdasjJruUzR1wwTk1tDdVBZauKwG8ZPFi1", "12D3KooWHSepUMWdNVgKPhdquR12AzSZrkHwUsfXvVfFMPGXpyH5", "12D3KooWDC3qNpRz5LdSfPWi3XWfc7kG5GHyEDNR2NcgJMedfu5v", "12D3KooWRQ8oUwhrW84UuVpQNZ2QxS2kg3SyhLwVkwHHk9vJgf5q", "12D3KooWHZaCXaMgavJYoH925jiLrLhsbPpU14tt6M7ypenDyfPc", "12D3KooWAd4GWfAqNTqoqTNnjsKqJHWNRezgcHi742eGYKDdYsfC", "12D3KooWFWc6NFCiuTxd9iKq9mi1n3G7nBEZ5yDkzzHjkGBSceje", "12D3KooWQ8yjECbzLThEwzcTQ3gtVgZbb1XPBrPyHnRkmLJRGfEW", "12D3KooWFsZdJERxRrc5afrFDxvts4bDxSHHDgQxh8bTm4Kq9PV7", "12D3KooWGpxgFFTXij8gXzx6YgExaVczUN2fuohccrkA11tGFzDu", "12D3KooWND9qfwCVtfB17y9fcThBKoWvCSpXrCQCs6XsWvHE5om2", "12D3KooWLoCosNXv1HESuU76r7xmp5UU4pdCncnZXB1hYvcbCYgX", "12D3KooWEga7tssCYmywnRU492ANXV4vGYqX5AVJrrAAKQ1zhhGN", "12D3KooWDP1pb16iGikYc8fkkL8ZYmzPqsrVRzQHHBDKxjRpUMNA", "12D3KooWG26t3Z1NfeAPNWdwrdWYntSUj69LzHcnBdV4PcQMEuHA", "12D3KooWS5DUgYPSQVrexXbPksR4cVsexFhLXzXFgsY47ZPeFHd9", "12D3KooWBWFtZqigVTC8W2GRMwLeuTK2o4hDC4XHVPyNV6hW1T1D", "12D3KooWDCboxcE7VAB3v3UJf1hrNZiswyk5Eg1u2kaiSs4v6Sbi", "12D3KooWNx1mbmwKXSPS8vuHkyVrQrZnwp4HGjLczPxFCpAyRhNS", "12D3KooWJ3KhEHCm4roQw2LAUGu28fXJf5QqQHhG6EaACw6RCUjr", "12D3KooWFnr5yyEcNAfdjJjfuBAMaZ2iz3GLyFrJAs5AiRJ74vWS", "12D3KooWMNeo7UgreqFxQ6BstVgZrNAZMVyKt9EWnC6AD9J2M1rT", "12D3KooWEVvqVD2mrLfmgeX1EXZ2caFXXEWWEs4Taa4mWzFUoF34", "12D3KooWMadAihMmvZmGt1HpxGAqqjb7Q2q96VVev6rGA1GLuqjv", "12D3KooWARM6duzRRd64fMJZJY3VqWekeG1rmJqxxjNLRYaQVPRt", "12D3KooWSqCyNpmVwaAxS1mMms2GQvUcPzPdoWB2XjiWpXvGW3Jf", "12D3KooWH22kTRSvhRnMUtu7Eg8d96Ma68jzRKV7vtxVMwB96kvS", "12D3KooWN1LBk84vnJEsQ33WsPRvpSzfrNMUZ2iLhTkUYjsSfwR5", "12D3KooWMxtE2fWGZZsZjfjoRN5aH6ecSKj8YfTkufi2vtywoKLS", "12D3KooWGMpAqtwpGR4tcQ3tc2ZThkTUN2YYcgxQsuSbfdQ4h3E4", "12D3KooWSyBLw12Z8rHRx2NSAfmb3cpAP6nJ2qK5FkdEC38zNVKk", "12D3KooWH7sqE4cp9wyLt5Z7xzuqA2imNGMeUHnu2gPJ4hGnJqJv", "12D3KooWK896roWsGutzksP9cZc3oypVPjRB1o83uHzjxM72V7zb"] )
//! [INFO ] Status: InBlock( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 )
//! [INFO ] Status: Finalized( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 )
//! [INFO ] Successfully submited call Gear::upload_code 0x2c54…e9d9 at 0x4409…fa04!
//! [INFO ] Balance spent: 3724868714
//! ```
//!
//! ## LICENSE
//!
//! GPL v3.0
pub mod api;
pub mod cmd;
Expand Down

0 comments on commit 5729c62

Please sign in to comment.