octomation/go-service

View on GitHub
.goreleaser.yml

Summary

Maintainability
Test Coverage
project_name: service

archives:
  - id: service
    builds:
      - client
      - server
    files:
      - LICENSE
    format: tar.gz
    name_template: "{{.ProjectName}}_{{.Version}}_{{.Os}}-{{.Arch}}"

brews:
  - name: service
    caveats: An example of the goreleaser usage.
    commit_author:
      name: Kamil Samigullin
      email: kamil@samigullin.info
    description: Template for a typical service written on Go.
    folder: Formula
    homepage: https://go-service.octolab.org/
    repository:
      owner: octolab
      name: homebrew-tap
    install: |
      bin.install "service"
      output = Utils.popen_read("#{bin}/server completion bash")
      (bash_completion/"server").write output
      output = Utils.popen_read("#{bin}/server completion fish")
      (fish_completion/"server.fish").write output
      output = Utils.popen_read("#{bin}/server completion zsh")
      (zsh_completion/"_server").write output

      bin.install "client"
      output = Utils.popen_read("#{bin}/client completion bash")
      (bash_completion/"client").write output
      output = Utils.popen_read("#{bin}/client completion fish")
      (fish_completion/"client.fish").write output
      output = Utils.popen_read("#{bin}/client completion zsh")
      (zsh_completion/"_client").write output
      prefix.install_metafiles
    test: |
      system "#{bin}/server version"
      system "#{bin}/client version"

builds:
  - id: client
    binary: client
    env:
      - CGO_ENABLED=0
    flags:
      - -trimpath
    goarch:
      - amd64
      - arm64
    goos:
      - darwin
      - linux
    ldflags:
      - -s -w -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.version={{.Version}}
    main: ./cmd/client
  - id: server
    binary: server
    env:
      - CGO_ENABLED=0
    flags:
      - -trimpath
    goarch:
      - amd64
      - arm64
    goos:
      - darwin
      - linux
    ldflags:
      - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
    main: ./cmd/server

checksum: { name_template: checksums.txt }

dockers:
  - id: server-linux-amd64
    goos: linux
    goarch: amd64
    ids:
      - server
    image_templates:
      - 'ghcr.io/octomation/go-service:{{.Tag}}-amd64'
      - 'ghcr.io/octomation/go-service:v{{.Major}}-amd64'
      - 'ghcr.io/octomation/go-service:v{{.Major}}.{{.Minor}}-amd64'
    use: buildx
    build_flag_templates:
      - '--pull'
      - '--label=org.opencontainers.image.revision={{.FullCommit}}'
      - '--label=org.opencontainers.image.created={{.Date}}'
      - '--label=org.opencontainers.image.version={{.Version}}'
      - '--platform=linux/amd64'
    extra_files:
      - deploy/config.toml
      - LICENSE
  - id: server-linux-arm64
    goos: linux
    goarch: arm64
    ids:
      - server
    image_templates:
      - 'ghcr.io/octomation/go-service:{{.Tag}}-arm64'
      - 'ghcr.io/octomation/go-service:v{{.Major}}-arm64'
      - 'ghcr.io/octomation/go-service:v{{.Major}}.{{.Minor}}-arm64'
    use: buildx
    build_flag_templates:
      - '--pull'
      - '--label=org.opencontainers.image.revision={{.FullCommit}}'
      - '--label=org.opencontainers.image.created={{.Date}}'
      - '--label=org.opencontainers.image.version={{.Version}}'
      - '--platform=linux/arm64'
    extra_files:
      - deploy/config.toml
      - LICENSE

docker_manifests:
  - name_template: 'ghcr.io/octomation/go-service:latest'
    image_templates:
      - 'ghcr.io/octomation/go-service:{{.Tag}}-amd64'
      - 'ghcr.io/octomation/go-service:{{.Tag}}-arm64'
  - name_template: 'ghcr.io/octomation/go-service:{{.Tag}}'
    image_templates:
      - 'ghcr.io/octomation/go-service:{{.Tag}}-amd64'
      - 'ghcr.io/octomation/go-service:{{.Tag}}-arm64'
  - name_template: 'ghcr.io/octomation/go-service:v{{.Major}}'
    image_templates:
      - 'ghcr.io/octomation/go-service:v{{.Major}}-amd64'
      - 'ghcr.io/octomation/go-service:v{{.Major}}-arm64'
  - name_template: 'ghcr.io/octomation/go-service:v{{.Major}}.{{.Minor}}'
    image_templates:
      - 'ghcr.io/octomation/go-service:v{{.Major}}.{{.Minor}}-amd64'
      - 'ghcr.io/octomation/go-service:v{{.Major}}.{{.Minor}}-arm64'

release:
  github:
    owner: octomation
    name: go-service