diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2dc858c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Release + +on: + push: + tags: ["v*"] + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: write + +jobs: + semver-checks: + name: Semver Checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - uses: obi1kenobi/cargo-semver-checks-action@v2 + with: + package: uds_protocol + + publish: + name: Publish to crates.io + needs: semver-checks + if: github.event_name == 'push' && vars.UDS_PROTOCOL_PUBLISH_ENABLED == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo install cargo-release --version '^0.25' --locked + # --allow-branch '*': a tag-push CI run is in detached-HEAD state, which + # cargo-release's branch check would otherwise reject. Publishing is + # already gated by the job `if:` above; this only relaxes the ref check. + - run: cargo release publish --allow-branch '*' --no-confirm --execute + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.gitignore b/.gitignore index f69dcae..44e7887 100644 --- a/.gitignore +++ b/.gitignore @@ -330,3 +330,5 @@ fuzz/artifacts/ .omniscient/ .DS_Store + +omniscient.toml diff --git a/Cargo.toml b/Cargo.toml index 9241df4..c2a0561 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,11 +11,11 @@ documentation = "https://docs.rs/uds_protocol" keywords = ["uds", "iso-14229", "automotive", "diagnostics", "obd"] categories = ["encoding", "embedded", "hardware-support"] authors = [ - "Justin Kovacich", - "Kimberly Kryger ", - "Matthew Beisser ", - "Parth Patel ", - "Zachary Heylmun ", + "Justin Kovacich ", + "Kimberly Kryger ", + "Matthew Beisser ", + "Parth Patel ", + "Zachary Heylmun ", ] [features] diff --git a/release.toml b/release.toml new file mode 100644 index 0000000..031f861 --- /dev/null +++ b/release.toml @@ -0,0 +1,8 @@ +# cargo-release config for the standalone uds_protocol repo (single crate). +publish = false +registry = "crates-io" +tag-name = "v{{version}}" +tag-message = "uds_protocol v{{version}}" +pre-release-commit-message = "chore(release): v{{version}}" +allow-branch = ["main"] +pre-release-hook = ["cargo", "test", "--locked"]