project_name: sing-box
builds:
  - id: main
    main: ./cmd/sing-box
    flags:
      - -v
      - -trimpath
    asmflags:
      - all=-trimpath={{.Env.GOPATH}}
    gcflags:
      - all=-trimpath={{.Env.GOPATH}}
    ldflags:
      - -X github.com/sagernet/sing-box/constant.Version={{ .Version }} -s -w -buildid=
    tags:
      - with_gvisor
      - with_quic
      - with_dhcp
      - with_wireguard
      - with_utls
      - with_reality_server
      - with_clash_api
    env:
      - CGO_ENABLED=0
    targets:
      - linux_amd64_v1
      - linux_amd64_v3
      - linux_arm64
      - linux_arm_7
      - linux_s390x
      - windows_amd64_v1
      - windows_amd64_v3
      - windows_386
      - windows_arm64
      - darwin_amd64_v1
      - darwin_amd64_v3
      - darwin_arm64
    mod_timestamp: '{{ .CommitTimestamp }}'
  - id: android
    main: ./cmd/sing-box
    flags:
      - -v
      - -trimpath
    asmflags:
      - all=-trimpath={{.Env.GOPATH}}
    gcflags:
      - all=-trimpath={{.Env.GOPATH}}
    ldflags:
      - -X github.com/sagernet/sing-box/constant.Version={{ .Version }} -s -w -buildid=
    tags:
      - with_gvisor
      - with_quic
      - with_dhcp
      - with_wireguard
      - with_utls
      - with_clash_api
    env:
      - CGO_ENABLED=1
    overrides:
      - goos: android
        goarch: arm
        goarm: 7
        env:
          - CC=armv7a-linux-androideabi19-clang
          - CXX=armv7a-linux-androideabi19-clang++
      - goos: android
        goarch: arm64
        env:
          - CC=aarch64-linux-android21-clang
          - CXX=aarch64-linux-android21-clang++
      - goos: android
        goarch: 386
        env:
          - CC=i686-linux-android19-clang
          - CXX=i686-linux-android19-clang++
      - goos: android
        goarch: amd64
        goamd64: v1
        env:
          - CC=x86_64-linux-android21-clang
          - CXX=x86_64-linux-android21-clang++
    targets:
      - android_arm_7
      - android_arm64
      - android_386
      - android_amd64
    mod_timestamp: '{{ .CommitTimestamp }}'
snapshot:
  name_template: "{{ .Version }}.{{ .ShortCommit }}"
archives:
  - id: archive
    format: tar.gz
    format_overrides:
      - goos: windows
        format: zip
    wrap_in_directory: true
    files:
      - LICENSE
    name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
nfpms:
  - id: package
    package_name: sing-box
    file_name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
    vendor: sagernet
    homepage: https://sing-box.sagernet.org/
    maintainer: nekohasekai <contact-git@sekai.icu>
    description: The universal proxy platform.
    license: GPLv3 or later
    formats:
      - deb
      - rpm
    priority: extra
    contents:
      - src: release/config/config.json
        dst: /etc/sing-box/config.json
        type: config
      - src: release/config/sing-box.service
        dst: /etc/systemd/system/sing-box.service
      - src: release/config/sing-box@.service
        dst: /etc/systemd/system/sing-box@.service
      - src: LICENSE
        dst: /usr/share/licenses/sing-box/LICENSE
source:
  enabled: false
  name_template: '{{ .ProjectName }}-{{ .Version }}.source'
  prefix_template: '{{ .ProjectName }}-{{ .Version }}/'
checksum:
  disable: true
  name_template: '{{ .ProjectName }}-{{ .Version }}.checksum'
signs:
  - artifacts: checksum
release:
  github:
    owner: SagerNet
    name: sing-box
  name_template: '{{ if .IsSnapshot }}{{ nightly }}{{ else }}{{ .Version }}{{ end }}'
  draft: true
  mode: replace