name: image
on:
  push:
    branches:
      - 'main'
      - 'release*'

permissions:
  contents: read
  packages: write
  id-token: write 

jobs:
  push-init-kyverno:
    uses: kyverno/kyverno/.github/workflows/reuse.yaml@main
    with:
      publish_command: docker-publish-initContainer
      digest_command: docker-get-initContainer-digest
      image_name: kyvernopre
      tag: image
    secrets:
      registry_username: ${{ github.actor }}
      registry_password: ${{ secrets.CR_PAT }}

  push-kyverno:
    uses: kyverno/kyverno/.github/workflows/reuse.yaml@main
    with:
      publish_command: docker-publish-kyverno
      digest_command: docker-get-kyverno-digest
      image_name: kyverno
      tag: image
    secrets:
      registry_username: ${{ github.actor }}
      registry_password: ${{ secrets.CR_PAT }}

  push-kyverno-cli:
    uses: kyverno/kyverno/.github/workflows/reuse.yaml@main
    with:
      publish_command: docker-publish-cli
      digest_command: docker-get-cli-digest
      image_name: kyverno-cli
      tag: image
    secrets:
      registry_username: ${{ github.actor }}
      registry_password: ${{ secrets.CR_PAT }}
