From e5767848eb94ef1767207c6ec5c5379ce4cb11b9 Mon Sep 17 00:00:00 2001 From: jadamcrain Date: Thu, 13 Nov 2025 12:17:17 -0800 Subject: [PATCH] automatically release to crates.io --- .github/workflows/ci.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6141cc2a..f02bb7a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -356,8 +356,27 @@ jobs: steps: - name: Quality checks passed run: echo "✅ All quality checks passed successfully" - + # Release jobs - each can run independently and is idempotent + release-crates-io: + needs: [quality-gate] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Publish to crates.io + run: | + VERSION=${{github.ref_name}} + if curl -f -s "https://crates.io/api/v1/crates/dnp3/$VERSION" > /dev/null 2>&1; then + echo "✅ dnp3 $VERSION already published to crates.io - skipping" + else + echo "Publishing dnp3 $VERSION to crates.io..." + cargo publish -p dnp3 --token ${{ secrets.CRATES_PUBLISH_TOKEN }} + fi + release-docs: needs: [packaging, quality-gate] runs-on: ubuntu-latest @@ -504,7 +523,7 @@ jobs: --skip-duplicate create-github-release: - needs: [release-docs, release-maven, release-nuget] + needs: [release-docs, release-maven, release-nuget, release-crates-io] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: