Merge pull request #346 from MichaelEischer/zip-for-windows

Build zip files for windows release binaries
This commit is contained in:
Michael Eischer 2025-05-20 19:09:48 +02:00 committed by GitHub
commit 7294612990
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 60 additions and 33 deletions

View file

@ -21,29 +21,27 @@ before:
# build a single binary
builds:
-
- id: default
# make sure everything is statically linked by disabling cgo altogether
env:
env: &build_env
- CGO_ENABLED=0
# set the package for the main binary
main: ./cmd/rest-server
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
mod_timestamp: '{{ .CommitTimestamp }}'
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
# set the version variable in the main package
ldflags: &build_ldflags # set the version variable in the main package
- "-s -w -X main.version={{ .Version }}"
# list all operating systems and architectures we build binaries for
goos:
- linux
- darwin
- windows
- freebsd
- netbsd
- openbsd
@ -52,7 +50,7 @@ builds:
goarch:
- amd64
- 386
- "386"
- arm
- arm64
- mips
@ -61,23 +59,39 @@ builds:
- ppc64
- ppc64le
goarm:
- 6
- 7
- "6"
- "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
archives:
-
- id: default
builds: [default, windows-only]
format: tar.gz
# package a directory which contains the source file
wrap_in_directory: true
builds_info: &archive_file_info
owner: root
group: root
mtime: '{{ .CommitDate }}'
mtime: "{{ .CommitDate }}"
mode: 0644
# add these files to all archives
files:
files: &archive_files
- src: LICENSE
dst: LICENSE
info: *archive_file_info
@ -88,13 +102,20 @@ archives:
dst: CHANGELOG.md
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
source:
enabled: true
# build a file containing the SHA256 hashes
checksum:
name_template: 'SHA256SUMS'
name_template: "SHA256SUMS"
# sign the checksum file
signs:
@ -128,7 +149,7 @@ dockers:
- docker/entrypoint.sh
- image_templates:
- restic/rest-server:{{ .Version }}-i386
goarch: 386
goarch: "386"
build_flag_templates:
- "--platform=linux/386"
- "--pull"
@ -204,21 +225,20 @@ dockers:
dockerfile: "Dockerfile.goreleaser"
extra_files: *extra_files
docker_manifests:
- name_template: "restic/rest-server:{{ .Version }}"
image_templates:
- "restic/rest-server:{{ .Version }}-amd64"
- "restic/rest-server:{{ .Version }}-i386"
- "restic/rest-server:{{ .Version }}-arm32v6"
- "restic/rest-server:{{ .Version }}-arm32v7"
- "restic/rest-server:{{ .Version }}-arm64v8"
- "restic/rest-server:{{ .Version }}-ppc64le"
- name_template: "restic/rest-server:latest"
image_templates:
- "restic/rest-server:{{ .Version }}-amd64"
- "restic/rest-server:{{ .Version }}-i386"
- "restic/rest-server:{{ .Version }}-arm32v6"
- "restic/rest-server:{{ .Version }}-arm32v7"
- "restic/rest-server:{{ .Version }}-arm64v8"
- "restic/rest-server:{{ .Version }}-ppc64le"
- name_template: "restic/rest-server:{{ .Version }}"
image_templates:
- "restic/rest-server:{{ .Version }}-amd64"
- "restic/rest-server:{{ .Version }}-i386"
- "restic/rest-server:{{ .Version }}-arm32v6"
- "restic/rest-server:{{ .Version }}-arm32v7"
- "restic/rest-server:{{ .Version }}-arm64v8"
- "restic/rest-server:{{ .Version }}-ppc64le"
- name_template: "restic/rest-server:latest"
image_templates:
- "restic/rest-server:{{ .Version }}-amd64"
- "restic/rest-server:{{ .Version }}-i386"
- "restic/rest-server:{{ .Version }}-arm32v6"
- "restic/rest-server:{{ .Version }}-arm32v7"
- "restic/rest-server:{{ .Version }}-arm64v8"
- "restic/rest-server:{{ .Version }}-ppc64le"

View file

@ -34,7 +34,7 @@
use another config file):
goreleaser \
release \
release --parallelism 4 \
--release-notes <(calens --template changelog/CHANGELOG-GitHub.tmpl --version "${VERSION}")
7. Set a new version in `main.go` and commit the result:

View file

@ -0,0 +1,7 @@
Enhancement: Add zip archive format for Windows releases
Windows users can now download rest-server binaries in zip archive format (.zip)
in addition to the existing tar.gz archives.
https://github.com/restic/rest-server/issues/321
https://github.com/restic/rest-server/pull/346