mdqy 0.1.4

jq for markdown: query and transform Markdown with a hybrid selector and jq DSL
Documentation
name: crate

on:
  workflow_call:
    inputs:
      plan:
        required: true
        type: string

jobs:
  publish-crate:
    runs-on: ubuntu-latest
    env:
      PLAN: ${{ inputs.plan }}
      CARGO_TERM_COLOR: always
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Verify tag matches Cargo.toml version
        run: |
          set -euo pipefail
          TAG=$(echo "$PLAN" | jq -r '.announcement_tag')
          TAG_VERSION="${TAG#v}"
          CARGO_VERSION=$(grep -m1 '^version' Cargo.toml | sed -E 's/.*"([^"]+)".*/\1/')
          if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
            echo "tag $TAG ($TAG_VERSION) != Cargo.toml $CARGO_VERSION"
            exit 1
          fi
      - name: Publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --features tty --allow-dirty