intervals-general 0.1.1

intervals-general is a crate enabling general representation of and operations on intervals over generic types (e.g. supporting units of measure or arbitrary built-in types, or any type with PartialOrd implementation).
Documentation
name: Release

on:
  push:
    tags:
      - v[0-9]+.*

jobs:
  create-release:
    name: Create GitHub Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Get version from tag
        id: get_version
        run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

      - name: Create GitHub Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref_name }}
          draft: false
          prerelease: false
          body: |
            See [CHANGELOG.md](CHANGELOG.md) for details.

  publish-crate:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: Check package version matches tag
        run: |
          CARGO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')
          TAG_VERSION="${GITHUB_REF#refs/tags/v}"
          if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
            echo "Package version ($CARGO_VERSION) does not match tag version ($TAG_VERSION)"
            exit 1
          fi

      - name: Publish to crates.io
        run: cargo publish --token ${CRATES_TOKEN}
        env:
          CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}