weimo-wdf 0.1.1

Strict canonical rich-text document model with adapters for Markdown, Tiptap/ProseMirror JSON, Apple document JSON, and terminal output
Documentation
name: Publish

on:
  push:
    tags:
      - "v*"

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  publish:
    name: Validate and publish
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: Check out source
        uses: actions/checkout@v4

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

      - name: Validate release tag
        if: github.ref_type == 'tag'
        shell: bash
        run: |
          set -euo pipefail
          version="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')"
          tag_version="${GITHUB_REF_NAME#v}"
          [[ "$tag_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
            echo "Tag $GITHUB_REF_NAME is not a semantic version tag" >&2
            exit 1
          }
          test "$version" = "$tag_version" || {
            echo "Tag $GITHUB_REF_NAME does not match Cargo.toml version $version" >&2
            exit 1
          }

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Run tests
        run: cargo test --locked

      - name: Run Clippy
        run: cargo clippy --all-targets --locked -- -D warnings

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