Skip to content

Commit e576784

Browse files
committed
automatically release to crates.io
1 parent 11ae614 commit e576784

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,27 @@ jobs:
356356
steps:
357357
- name: Quality checks passed
358358
run: echo "✅ All quality checks passed successfully"
359-
359+
360360
# Release jobs - each can run independently and is idempotent
361+
release-crates-io:
362+
needs: [quality-gate]
363+
runs-on: ubuntu-latest
364+
if: startsWith(github.ref, 'refs/tags/')
365+
steps:
366+
- name: Checkout
367+
uses: actions/checkout@v4
368+
- name: Install Rust
369+
uses: dtolnay/rust-toolchain@stable
370+
- name: Publish to crates.io
371+
run: |
372+
VERSION=${{github.ref_name}}
373+
if curl -f -s "https://crates.io/api/v1/crates/dnp3/$VERSION" > /dev/null 2>&1; then
374+
echo "✅ dnp3 $VERSION already published to crates.io - skipping"
375+
else
376+
echo "Publishing dnp3 $VERSION to crates.io..."
377+
cargo publish -p dnp3 --token ${{ secrets.CRATES_PUBLISH_TOKEN }}
378+
fi
379+
361380
release-docs:
362381
needs: [packaging, quality-gate]
363382
runs-on: ubuntu-latest
@@ -504,7 +523,7 @@ jobs:
504523
--skip-duplicate
505524
506525
create-github-release:
507-
needs: [release-docs, release-maven, release-nuget]
526+
needs: [release-docs, release-maven, release-nuget, release-crates-io]
508527
runs-on: ubuntu-latest
509528
if: startsWith(github.ref, 'refs/tags/')
510529
steps:

0 commit comments

Comments
 (0)