Update versioning and CI workflows for improved stability and documen… #7
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: | ||
| tags: | ||
| - "v*.*.*" | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| validate: | ||
| name: Validate Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Ensure tag points to main | ||
| run: | | ||
| git fetch origin main --depth=1 | ||
| git merge-base --is-ancestor "${GITHUB_SHA}" origin/main | ||
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| components: rustfmt, clippy | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - name: Format check | ||
| run: cargo fmt --check | ||
| - name: Clippy | ||
| run: cargo clippy --all-targets --all-features -- -D warnings | ||
| - name: Tests | ||
| run: cargo test --all-features --all-targets | ||
| - name: Docs | ||
| run: cargo doc --no-deps --all-features | ||
| env: | ||
| RUSTDOCFLAGS: -Dwarnings | ||
| - name: Package verification | ||
| run: | | ||
| cargo package | ||
| cargo publish --dry-run | ||
| release: | ||
| name: GitHub Release | ||
| runs-on: ubuntu-latest | ||
| needs: validate | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| generate_release_notes: true | ||
| publish: | ||
| name: Publish to crates.io | ||
| runs-on: ubuntu-latest | ||
| needs: validate | ||
| if: ${{ secrets.CARGO_REGISTRY_TOKEN != '' }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| - name: Publish crate | ||
| env: | ||
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
| run: cargo publish | ||