Merge pull request #346 from MichaelEischer/zip-for-windows
Some checks are pending
test / lint (push) Waiting to run
test / Analyze results (push) Blocked by required conditions
test / Linux Go 1.23.x (push) Waiting to run
test / Linux (race) Go 1.24.x (push) Waiting to run
test / Linux Go 1.24.x (push) Waiting to run

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
3 changed files with 60 additions and 33 deletions

View File

@@ -21,29 +21,27 @@ before:
# build a single binary # build a single binary
builds: builds:
- - id: default
# make sure everything is statically linked by disabling cgo altogether # make sure everything is statically linked by disabling cgo altogether
env: 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
@@ -52,7 +50,7 @@ builds:
goarch: goarch:
- amd64 - amd64
- 386 - "386"
- arm - arm
- arm64 - arm64
- mips - mips
@@ -61,23 +59,39 @@ 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:
- - id: default
builds: [default, windows-only]
format: tar.gz
# package a directory which contains the source file # 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
owner: root owner: root
group: root group: root
mtime: '{{ .CommitDate }}' mtime: "{{ .CommitDate }}"
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
@@ -88,13 +102,20 @@ 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
# build a file containing the SHA256 hashes # build a file containing the SHA256 hashes
checksum: checksum:
name_template: 'SHA256SUMS' name_template: "SHA256SUMS"
# sign the checksum file # sign the checksum file
signs: signs:
@@ -128,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"
@@ -204,21 +225,20 @@ dockers:
dockerfile: "Dockerfile.goreleaser" dockerfile: "Dockerfile.goreleaser"
extra_files: *extra_files extra_files: *extra_files
docker_manifests: docker_manifests:
- name_template: "restic/rest-server:{{ .Version }}" - name_template: "restic/rest-server:{{ .Version }}"
image_templates: image_templates:
- "restic/rest-server:{{ .Version }}-amd64" - "restic/rest-server:{{ .Version }}-amd64"
- "restic/rest-server:{{ .Version }}-i386" - "restic/rest-server:{{ .Version }}-i386"
- "restic/rest-server:{{ .Version }}-arm32v6" - "restic/rest-server:{{ .Version }}-arm32v6"
- "restic/rest-server:{{ .Version }}-arm32v7" - "restic/rest-server:{{ .Version }}-arm32v7"
- "restic/rest-server:{{ .Version }}-arm64v8" - "restic/rest-server:{{ .Version }}-arm64v8"
- "restic/rest-server:{{ .Version }}-ppc64le" - "restic/rest-server:{{ .Version }}-ppc64le"
- name_template: "restic/rest-server:latest" - name_template: "restic/rest-server:latest"
image_templates: image_templates:
- "restic/rest-server:{{ .Version }}-amd64" - "restic/rest-server:{{ .Version }}-amd64"
- "restic/rest-server:{{ .Version }}-i386" - "restic/rest-server:{{ .Version }}-i386"
- "restic/rest-server:{{ .Version }}-arm32v6" - "restic/rest-server:{{ .Version }}-arm32v6"
- "restic/rest-server:{{ .Version }}-arm32v7" - "restic/rest-server:{{ .Version }}-arm32v7"
- "restic/rest-server:{{ .Version }}-arm64v8" - "restic/rest-server:{{ .Version }}-arm64v8"
- "restic/rest-server:{{ .Version }}-ppc64le" - "restic/rest-server:{{ .Version }}-ppc64le"

View File

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