From 2bb4d251e2d3c4019e1fc8eab7600fbade1dedf5 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Mon, 14 Apr 2025 22:30:37 +0200 Subject: [PATCH 1/4] autoformat goreleaser yaml --- .goreleaser.yml | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index ecd642d..f9d70aa 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -21,8 +21,7 @@ before: # build a single binary builds: - - - # make sure everything is statically linked by disabling cgo altogether + - # make sure everything is statically linked by disabling cgo altogether env: - CGO_ENABLED=0 @@ -33,7 +32,7 @@ builds: # 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 @@ -66,14 +65,13 @@ builds: # configure the resulting archives to create archives: - - - # package a directory which contains the source file + - # 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 @@ -94,7 +92,7 @@ source: # build a file containing the SHA256 hashes checksum: - name_template: 'SHA256SUMS' + name_template: "SHA256SUMS" # sign the checksum file signs: @@ -204,21 +202,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" From df5330773f80f69f1a091e32748704dae4c4f0f1 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Thu, 15 May 2025 20:50:54 +0200 Subject: [PATCH 2/4] also generate zip files for windows --- .goreleaser.yml | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index f9d70aa..679be27 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -21,28 +21,27 @@ before: # build a single binary builds: - - # make sure everything is statically linked by disabling cgo altogether - env: + - id: default + # make sure everything is statically linked by disabling cgo altogether + 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 }}" - 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 @@ -51,7 +50,7 @@ builds: goarch: - amd64 - - 386 + - "386" - arm - arm64 - mips @@ -60,12 +59,29 @@ 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: - - # 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 builds_info: &archive_file_info @@ -75,7 +91,7 @@ archives: mode: 0644 # add these files to all archives - files: + files: &archive_files - src: LICENSE dst: LICENSE info: *archive_file_info @@ -86,6 +102,13 @@ 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 @@ -126,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" From 72a7319fae2da349bc299efdb5f18ba17b195750 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Thu, 15 May 2025 20:51:10 +0200 Subject: [PATCH 3/4] limit build parallelism --- Release.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Release.md b/Release.md index 3e37751..cb32c66 100644 --- a/Release.md +++ b/Release.md @@ -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: From 25066228ee603ba4658665e99e9b1fc6b2423284 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Thu, 15 May 2025 21:03:05 +0200 Subject: [PATCH 4/4] add changelog for windows zip binaries --- changelog/unreleased/issue-321 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelog/unreleased/issue-321 diff --git a/changelog/unreleased/issue-321 b/changelog/unreleased/issue-321 new file mode 100644 index 0000000..e2c4f99 --- /dev/null +++ b/changelog/unreleased/issue-321 @@ -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