# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

before:
  hooks:
    - go mod tidy
    - go run mage.go GenerateAll
    - mkdir -p out
    - sh -c "cd config/release/default && kustomize edit set image supabase-operator=code.icb4dc0.de/prskr/supabase-operator:{{.Version}}"
    - sh -c "kustomize build config/release/default > out/operator_manifest.yaml"

builds:
  - id: operator
    main: ./cmd/
    env:
      - CGO_ENABLED=0
    goos:
      - linux
    goarch:
      - amd64
      - arm64

kos:
  - id: operator
    build: operator
    base_image: gcr.io/distroless/static:nonroot
    user: "65532:65532"
    repositories:
      - code.icb4dc0.de/prskr/supabase-operator
    platforms:
      - linux/amd64
      - linux/arm64
    tags:
      - latest
      - "{{.Version}}"
      - "{{if not .Prerelease}}stable{{end}}"
    creation_time: "{{.CommitTimestamp}}"
    bare: true
    preserve_import_paths: false
    base_import_paths: true

changelog:
  sort: asc
  filters:
    exclude:
      - "^docs:"
      - "^test:"

release:
  gitea:
    owner: prskr
    name: supabase-operator
  extra_files:
    - glob: out/operator_manifest.yaml
      name_template: "supabase-operator-{{.Tag}}.yaml"
  footer: >-

    ---

    Released by [GoReleaser](https://github.com/goreleaser/goreleaser).