asx 0.20.0

AS2 and AS4 (ebMS3) B2B messaging: BDEW, Peppol, eDelivery and ENTSOG profiles, signed receipts and MDNs, one tower Service to receive
name: Release

# Push a `vX.Y.Z` tag on main: CI runs for that commit, then the crate is
# published to crates.io (Trusted Publishing, no stored token) and a GitHub
# release is created from the CHANGELOG section. See RELEASING.md.
on:
  push:
    tags: ["v*"]

permissions:
  contents: read

jobs:
  ci:
    uses: ./.github/workflows/ci.yml

  publish:
    needs: ci
    runs-on: ubuntu-latest
    timeout-minutes: 20
    environment: crates-io
    permissions:
      contents: write # the GitHub release
      id-token: write # crates.io Trusted Publishing
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - name: Tag, Cargo.toml and CHANGELOG agree
        run: |
          version="${GITHUB_REF_NAME#v}"
          manifest=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
          [ "$version" = "$manifest" ] || { echo "tag $GITHUB_REF_NAME != Cargo.toml $manifest"; exit 1; }
          awk -v v="$version" '
            index($0, "## [" v "]") == 1 { on = 1; next }
            on && /^## \[/ { exit }
            on { print }
          ' CHANGELOG.md > "$RUNNER_TEMP/notes.md"
          [ -s "$RUNNER_TEMP/notes.md" ] || { echo "CHANGELOG.md has no ## [$version] section"; exit 1; }
      - run: rustup toolchain install stable --profile minimal --no-self-update && rustup default stable
      - name: The packaged crate builds with every feature
        run: bash scripts/package-check.sh
      - uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
        id: auth
      - run: cargo publish --locked -p asx
        env:
          CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
      - run: gh release create "$GITHUB_REF_NAME" --verify-tag --title "asx $GITHUB_REF_NAME" --notes-file "$RUNNER_TEMP/notes.md"
        env:
          GH_TOKEN: ${{ github.token }}