# Badge generation + README embedding via Narrator.
# Demonstrates both badge systems:
#   kind: badge  — local SVG generation (branded assets)
#   kind: props  — external badge composition (ecosystem badges)
version: 1

vars:
  org: myorg
  repo: myapp

sources:
  primary:
    kind: git
    url: "https://github.com/{var:org}/{var:repo}"
    default_branch: "main"

builds:
  - id: myapp
    kind: docker

targets:
  - id: dockerhub
    kind: registry
    build: myapp
    url: docker.io
    path: "{var:org}/{var:repo}"
    tags: ["{version}", "latest"]
    credentials: DOCKER

  - id: dockerhub-readme
    kind: docker-readme
    url: docker.io
    path: "{var:org}/{var:repo}"
    credentials: DOCKER
    file: "README.md"
    link_base: "https://github.com/{var:org}/{var:repo}/blob/main"

narrator:
  - file: "README.md"
    link_base: "https://github.com/{var:org}/{var:repo}/blob/main"
    items:
      - id: badge.release
        kind: badge
        placement:
          between: ["<!-- sf:badges:start -->", "<!-- sf:badges:end -->"]
          mode: replace
          inline: true
        text: release
        color: "#74ecbe"
        output: ".stagefreight/badges/release.svg"
        link: "https://github.com/{var:org}/{var:repo}/releases"

      - id: shield.pulls
        kind: shield
        placement:
          between: ["<!-- sf:badges:start -->", "<!-- sf:badges:end -->"]
          mode: replace
          inline: true
        shield: "docker/pulls/{var:org}/{var:repo}"
        link: "https://hub.docker.com/r/{var:org}/{var:repo}"

      # External ecosystem badges (props) — separate section marker
      - id: prop.github-release
        kind: props
        type: github-release
        placement:
          between: ["<!-- sf:props:start -->", "<!-- sf:props:end -->"]
          mode: replace
          inline: true
        params:
          repo: "{var:org}/{var:repo}"

      - id: prop.docker-size
        kind: props
        type: docker-image-size
        placement:
          between: ["<!-- sf:props:start -->", "<!-- sf:props:end -->"]
          mode: replace
          inline: true
        params:
          image: "{var:org}/{var:repo}"
