# Release target with rolling tags and retention.
version: 1

policies:
  git_tags:
    stable: "^v?\\d+\\.\\d+\\.\\d+$"
    prerelease: "^v?\\d+\\.\\d+\\.\\d+-.+"

builds:
  - id: myapp
    kind: docker

targets:
  - id: dockerhub-stable
    kind: registry
    build: myapp
    url: docker.io
    path: myorg/myapp
    tags: ["{version}", "{major}.{minor}", "latest"]
    when: { git_tags: [stable], events: [tag] }
    credentials: DOCKER
    retention:
      keep_last: 10
      keep_monthly: 6

  - id: primary-release
    kind: release
    aliases: ["{version}", "{major}.{minor}", "latest"]
    when: { git_tags: [stable], events: [tag] }
