also generate zip files for windows

This commit is contained in:
Michael Eischer
2025-05-15 20:50:54 +02:00
parent 2bb4d251e2
commit df5330773f

View File

@@ -21,28 +21,27 @@ before:
# build a single binary # build a single binary
builds: builds:
- # make sure everything is statically linked by disabling cgo altogether - id: default
env: # make sure everything is statically linked by disabling cgo altogether
env: &build_env
- CGO_ENABLED=0 - CGO_ENABLED=0
# set the package for the main binary # set the package for the main binary
main: ./cmd/rest-server main: ./cmd/rest-server
flags: flags:
# don't include any paths to source files in the resulting binary &build_flags # don't include any paths to source files in the resulting binary
- -trimpath - -trimpath
mod_timestamp: "{{ .CommitTimestamp }}" mod_timestamp: "{{ .CommitTimestamp }}"
ldflags: ldflags: &build_ldflags # set the version variable in the main package
# set the version variable in the main package
- "-s -w -X main.version={{ .Version }}" - "-s -w -X main.version={{ .Version }}"
# list all operating systems and architectures we build binaries for # list all operating systems and architectures we build binaries for
goos: goos:
- linux - linux
- darwin - darwin
- windows
- freebsd - freebsd
- netbsd - netbsd
- openbsd - openbsd
@@ -51,7 +50,7 @@ builds:
goarch: goarch:
- amd64 - amd64
- 386 - "386"
- arm - arm
- arm64 - arm64
- mips - mips
@@ -60,12 +59,29 @@ builds:
- ppc64 - ppc64
- ppc64le - ppc64le
goarm: goarm:
- 6 - "6"
- 7 - "7"
- id: windows-only
env: *build_env
main: ./cmd/rest-server
flags: *build_flags
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags: *build_ldflags
goos:
- windows
goarch:
- amd64
- "386"
- arm
- arm64
# configure the resulting archives to create # configure the resulting archives to create
archives: archives:
- # package a directory which contains the source file - id: default
builds: [default, windows-only]
format: tar.gz
# package a directory which contains the source file
wrap_in_directory: true wrap_in_directory: true
builds_info: &archive_file_info builds_info: &archive_file_info
@@ -75,7 +91,7 @@ archives:
mode: 0644 mode: 0644
# add these files to all archives # add these files to all archives
files: files: &archive_files
- src: LICENSE - src: LICENSE
dst: LICENSE dst: LICENSE
info: *archive_file_info info: *archive_file_info
@@ -86,6 +102,13 @@ archives:
dst: CHANGELOG.md dst: CHANGELOG.md
info: *archive_file_info info: *archive_file_info
- id: windows-only
builds: [windows-only]
formats: [zip]
wrap_in_directory: true
builds_info: *archive_file_info
files: *archive_files
# also build an archive of the source code # also build an archive of the source code
source: source:
enabled: true enabled: true
@@ -126,7 +149,7 @@ dockers:
- docker/entrypoint.sh - docker/entrypoint.sh
- image_templates: - image_templates:
- restic/rest-server:{{ .Version }}-i386 - restic/rest-server:{{ .Version }}-i386
goarch: 386 goarch: "386"
build_flag_templates: build_flag_templates:
- "--platform=linux/386" - "--platform=linux/386"
- "--pull" - "--pull"