evorule-primitives 0.1.0

EvoRule base primitive types: the deterministic JSON value model and the I/O handler contract (single definition site, zero evorule-* dependencies)
Documentation
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (C) 2026 EvoRule Project
# Release workflow for EvoRule Primitives (base primitive crate).
#
# Trigger: push of a v* tag. Pure lib crate, no binary artifacts —
# Release content = verification (fmt + clippy + tests) + crates.io publish
# (fail-closed on missing token) + GitHub Release (tag notes).
name: Release

on:
  push:
    tags: ["v*"]
  workflow_dispatch: {}

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always

jobs:
  verify:
    name: verify (fmt + clippy + tests)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt

      - name: fmt check
        run: cargo fmt --check

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

      - name: tests
        run: cargo test

  publish-crate:
    needs: [verify]
    name: publish crates.io
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable

      - name: publish (fail-closed on missing token)
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          set -e
          if [ -z "$CARGO_REGISTRY_TOKEN" ]; then
            {
              echo "### crates.io publish blocked (fail-closed)"
              echo ""
              echo "CARGO_REGISTRY_TOKEN secret is not configured. Publication is a"
              echo "hard release constraint; a missing secret must never pass silently."
              echo "Fix: repo Settings -> Secrets and variables -> Actions ->"
              echo "configure CARGO_REGISTRY_TOKEN, then rerun failed jobs."
            } >> "${GITHUB_STEP_SUMMARY}"
            echo "ERROR: CARGO_REGISTRY_TOKEN secret not configured - publication blocked (fail-closed); configure the secret then rerun this job"
            exit 1
          fi
          VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
          existing=$(curl -s -A "evorule-release/0.1 (support@evorule.dev)" "https://crates.io/api/v1/crates/evorule-primitives" | sed -n 's/.*"newest_version":"\([^"]*\)".*/\1/p')
          if [ "$existing" = "$VERSION" ]; then
            echo "== skip evorule-primitives (already published at $VERSION) =="
          else
            echo "== cargo publish evorule-primitives =="
            cargo publish -p evorule-primitives
          fi
          echo "## Published" >> "${GITHUB_STEP_SUMMARY}"
          echo "- evorule-primitives ${VERSION}" >> "${GITHUB_STEP_SUMMARY}"

  release:
    name: GitHub Release
    runs-on: ubuntu-latest
    needs: [publish-crate]
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4

      - name: Create GitHub Release
        env:
          GH_TOKEN: ${{ github.token }}
        run: gh release create "${{ github.ref_name }}" --verify-tag --generate-notes