# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com

env_files:
  #github_token: .env
  gitea_token: .env

project_name: goInventorize

env:
  - P_NAME_LOWER=goinventorize

before:
  hooks:
    # You may remove this if you don't use go modules.
    - go mod tidy
    # you may remove this if you don't need go generate
    - go generate ./...
builds:
  - 
    main: main.go
    binary: "{{.ProjectName}}-{{.Os}}-{{.Arch}}"
    env:
      - CGO_ENABLED=0
      - PORT=3000
    goos:
      - linux
      - windows
      - darwin
    goarch:
      - amd64
      # - arm
      # - arm64

archives:
  - replacements:
      darwin: Darwin
      linux: Linux
      windows: Windows
      386: i386
      amd64: x86_64

  - format_overrides:
    - goos: windows
      format: zip

  - files:
    - LICENSE
    - README.md
    - frontend/build/**/*
    - defaults/*
dockers:
  - 
    goos: linux
    goarch: amd64
    # ids:
    #   - "linux-amd64"
    # Templates of the Docker image names.
    extra_files:
      - README.md
    image_templates:
    - "deranjer/{{ .Env.P_NAME_LOWER }}:latest"
    - "deranjer/{{ .Env.P_NAME_LOWER }}:{{ .Tag }}"
    - "deranjer/{{ .Env.P_NAME_LOWER }}:{{ .Tag }}-{{ .Env.GO_VERSION }}"
    - "deranjer/{{ .Env.P_NAME_LOWER }}:v{{ .Major }}"
    - "ghcr.io/deranjer/{{ .Env.P_NAME_LOWER }}:latest"

    dockerfile: Dockerfile

    build_flag_templates:
      - "--pull"
      - "--label=org.opencontainers.image.created={{.Date}}"
      - "--label=org.opencontainers.image.title={{.ProjectName}}"
      - "--label=org.opencontainers.image.revision={{.FullCommit}}"
      - "--label=org.opencontainers.image.version={{.Version}}"
      - "--platform=linux/amd64"

release:
  gitea:
    owner: deranjer
    name: "{{.ProjectName}}"
  draft: true
  prerelease: auto

gitea_urls:
  api: https://gitea.derajnet.duckdns.org/api/v1/
  download: https://gitea.derajnet.duckdns.org

checksum:
  name_template: 'checksums.txt'
snapshot:
  name_template: "{{ .Tag }}-next"
changelog:
  sort: asc
  filters:
    exclude:
      - '^docs:'
      - '^test:'
