chore(readme): Fix version #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '**.rs' | |
| - '**/Cargo.toml' | |
| - '**/Cargo.lock' | |
| - '.github/workflows/release.yml' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| release: | |
| name: Semantic Release | |
| runs-on: ubuntu-latest | |
| environment: main | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| run: cargo install cargo-llvm-cov | |
| - name: Install rustfilt | |
| run: cargo install rustfilt | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run Clippy with pedantic and nursery | |
| run: | | |
| cargo clippy --all-targets --all-features -- \ | |
| -W clippy::pedantic \ | |
| -W clippy::nursery \ | |
| -D warnings | |
| - name: Generate test coverage | |
| run: cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info --branch | |
| - name: Demangle coverage output | |
| run: rustfilt -i lcov.info -o lcov-demangled.info | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: lcov-demangled.info | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Build all examples | |
| run: cargo build --examples --all-features --verbose | |
| - name: Run all examples | |
| run: | | |
| for example in examples/*.rs; do | |
| example_name=$(basename "$example" .rs) | |
| echo "Running example: $example_name" | |
| cargo run --example "$example_name" --all-features || exit 1 | |
| done | |
| - name: Build package | |
| run: cargo build --release --all-features | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 'lts/*' | |
| - name: Install semantic-release and plugins | |
| run: | | |
| npm install -g \ | |
| semantic-release@latest \ | |
| @semantic-release/git@latest \ | |
| @semantic-release/changelog@latest \ | |
| @semantic-release/exec@latest \ | |
| conventional-changelog-conventionalcommits@latest | |
| - name: Semantic Release | |
| id: semantic | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} | |
| run: | | |
| npx semantic-release | |
| echo "new_release_published=$([ -f .semanticRelease ])" >> $GITHUB_OUTPUT | |
| - name: Publish to crates.io | |
| run: | | |
| if cargo publish --token ${{ secrets.CARGO_TOKEN }} --allow-dirty 2>&1 | grep -q "crate version .* is already uploaded"; then | |
| echo "Version already published, skipping" | |
| exit 0 | |
| fi | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} |