From f7f80f503d93cb5d2d049240d9d56a4bec810f92 Mon Sep 17 00:00:00 2001 From: Olexander Hofman Date: Fri, 19 Jul 2024 18:54:42 +0100 Subject: [PATCH] added chain validation --- .github/workflows/release2.yml | 35 +++++++++++++++++++++++++--------- Cargo.toml | 4 ++++ src/commands/agent/publish.rs | 5 ++++- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release2.yml b/.github/workflows/release2.yml index b1c3578..f2c120b 100644 --- a/.github/workflows/release2.yml +++ b/.github/workflows/release2.yml @@ -12,6 +12,8 @@ env: RUST_BACKTRACE: 1 CARGO_NET_GIT_FETCH_WITH_CLI: true +permissions: + contents: write jobs: build: @@ -68,18 +70,18 @@ jobs: - name: Build binary uses: houseabsolute/actions-rust-cross@v0 with: - command: ${{ matrix.platform.command }} + command: "build" target: ${{ matrix.platform.target }} args: "--locked --release" strip: true - name: Package release binaries run: | - cd target/${{ matrix.platform.target }}/release + cd target/${{ matrix.platform.target }}/release/ if [[ "${{ matrix.platform.name }}" == *.zip ]]; then - zip ${{ matrix.platform.name }} ${{ matrix.platform.bin }} + zip ${{ matrix.platform.bin }}-${{ matrix.platform.name }} ${{ matrix.platform.bin }} else - tar -czvf ${{ matrix.platform.name }} ${{ matrix.platform.bin }} + tar -czvf ${{ matrix.platform.bin }}-${{ matrix.platform.name }}.tar.gz ${{ matrix.platform.bin }} fi shell: bash @@ -101,13 +103,28 @@ jobs: with: path: ./release-binaries - - name: Upload release binaries to GitHub Release - uses: ncipollo/release-action@v1 +# - name: Upload release binaries to GitHub Release +# uses: ncipollo/release-action@v1 +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# tag: ${{ github.event.inputs.tag }} +# name: Release ${{ github.event.inputs.tag }} +# artifacts: "./release-binaries/mamorurs-cli-*" + + - name: release + uses: softprops/action-gh-release@v2 with: + files: ./release-binaries/* + draft: false + prerelease: false + tag_name: ${{ github.event.inputs.tag }} + release_name: ${{ github.event.inputs.tag }} + body: "Release ${{ github.event.inputs.tag }}" token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.event.inputs.tag }} - name: Release ${{ github.event.inputs.tag }} - artifacts: "./release-binaries/mamorurs-cli-*" + generate_release_notes: false + + + # - uses: AButler/upload-release-assets@v3.0 # with: diff --git a/Cargo.toml b/Cargo.toml index 18df8af..7d1e8e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,3 +41,7 @@ tonic-build = "0.9" [dev-dependencies] mockito = "0.29.0" sealed_test = "1.1.0" + +[profile.release] +# Tell `rustc` to optimize for small code size. +opt-level = "s" diff --git a/src/commands/agent/publish.rs b/src/commands/agent/publish.rs index b8e7b27..de6eb5b 100644 --- a/src/commands/agent/publish.rs +++ b/src/commands/agent/publish.rs @@ -29,7 +29,10 @@ pub async fn publish_agent( ) -> Result> { let manifest = read_manifest_file(dir_path).expect("Manifest file not found"); - println!("Publishing agent to chain: {color_green}{}{color_reset}", chain_name); + println!( + "Publishing agent to chain: {color_green}{}{color_reset}", + chain_name + ); if !check_supported_chains(&manifest.supported_chains, &chain_name) { eprintln!(