From 0cd536d3c9b67b322559b6136cf51091545ee913 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Wed, 9 Oct 2024 15:50:45 +1100 Subject: [PATCH] gha: rust: publish crate from github action Signed-off-by: Aleksa Sarai --- .github/workflows/rust.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index de2358a..a680a83 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -127,7 +127,23 @@ jobs: components: clippy - run: cargo clippy --all-features --all-targets + release-crate: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + environment: + name: release-crate + url: "https://crates.io/crates/pathrs" + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + complete: + if: ${{ ! failure() && ! cancelled() }} needs: - check - check-msrv @@ -136,6 +152,7 @@ jobs: - examples - fmt - clippy + - release-crate runs-on: ubuntu-latest steps: - run: echo "Rust CI jobs completed successfully."