native_messaging 0.2.0

Cross-platform Rust native messaging host for browser extensions (Chrome & Firefox), with async helpers and manifest installer.
Documentation
name: Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

concurrency:
  group: release-${{ github.ref_name }}
  cancel-in-progress: false

jobs:
  publish:
    name: GitHub Release + publish to crates.io
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust (stable)
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: Cache cargo
        uses: Swatinem/rust-cache@v2

      # --- Derive version from tag (strip leading 'v') ---
      - name: Derive version from tag
        id: ver
        shell: bash
        run: |
          TAG="${GITHUB_REF_NAME}"
          VERSION="${TAG#v}"
          echo "tag=$TAG" >> "$GITHUB_OUTPUT"
          echo "version=$VERSION" >> "$GITHUB_OUTPUT"

      # --- Safety: ensure Cargo.toml version matches the tag version ---
      - name: Verify Cargo.toml version matches tag
        shell: bash
        run: |
          TOML_VER="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')"
          if [ "$TOML_VER" != "${{ steps.ver.outputs.version }}" ]; then
            echo "ERROR: Cargo.toml version ($TOML_VER) does not match tag version (${{ steps.ver.outputs.version }})"
            exit 1
          fi

      # --- Quality gates ---
      - name: rustfmt (check)
        run: cargo fmt --all -- --check

      - name: clippy (deny warnings)
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Tests
        run: cargo test --all-features --all-targets

      # --- Create GitHub Release (auto date) ---
      - name: Compute release date (UTC)
        id: date
        run: echo "date=$(date -u +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          name: "${{ steps.ver.outputs.tag }} (${{ steps.date.outputs.date }})"
          generate_release_notes: false
          body: |
            ## native_messaging ${{ steps.ver.outputs.tag }}

            **Release date:** ${{ steps.date.outputs.date }}

            ### Links
            - 📦 Crates.io: https://crates.io/crates/native_messaging
            - 📚 Docs.rs: https://docs.rs/native_messaging
            - 🧑‍💻 Repo: https://github.com/IberAI/native-messaging

            ### Install / Upgrade
            ```toml
            native_messaging = "${{ steps.ver.outputs.version }}"
            ```

      # --- Publish to crates.io ---
      - name: Publish to crates.io
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --locked