From 071075c98f03200060bb3df51a6199836b8ae4d8 Mon Sep 17 00:00:00 2001 From: Thomas Luijken Date: Thu, 21 Dec 2023 14:46:41 +0100 Subject: [PATCH] Added action to publish to crates.io --- .github/workflows/cargo-build-and-test.yaml | 28 +++++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cargo-build-and-test.yaml b/.github/workflows/cargo-build-and-test.yaml index ddd8929..2f0bba1 100644 --- a/.github/workflows/cargo-build-and-test.yaml +++ b/.github/workflows/cargo-build-and-test.yaml @@ -1,7 +1,12 @@ -on: [push] - name: Cargo build and test +on: + push: + branches: [ develop, master, release/**, hotfix/** ] + pull_request: + branches: [ develop, master, release/**, hotfix/** ] + + jobs: build_and_test: name: Build and test Stellar SDK @@ -11,9 +16,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable - target: x86_64-unknown-linux-musl override: true - components: llvm-tools-preview - uses: actions-rs/cargo@v1 name: cargo update with: @@ -23,7 +26,16 @@ jobs: with: command: test - # - uses: actions-rs/cargo@v1 - # with: - # command: build - # args: --release --all-features + publish_to_crates_io: + needs: build_and_test + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + name: "Publish to crates.io" + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: katyo/publish-crates@v2 + with: + registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}