Skip to content

Commit

Permalink
improve release reproducibility
Browse files Browse the repository at this point in the history
- trim paths
- set build ID to empty string
- set binary timestamp to commit timestamp
- strip binary (reduces size from 9.2MB to 8.5MB)

Signed-off-by: Paul Meyer <[email protected]>
  • Loading branch information
katexochen committed Sep 12, 2023
1 parent 12a0bac commit bdc9b48
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ builds:
binary: ./oras
env:
- CGO_ENABLED=0
flags:
- -trimpath
goos:
- darwin
- linux
Expand All @@ -42,7 +44,8 @@ builds:
ldflags:
# one-line ldflags to bypass the goreleaser bugs
# the git tree state is guaranteed to be clean by goreleaser
- -w -X oras.land/oras/internal/version.Version={{.Version}} -X oras.land/oras/internal/version.GitCommit={{.FullCommit}} -X oras.land/oras/internal/version.BuildMetadata= -X oras.land/oras/internal/version.GitTreeState=clean
- -w -s -buildid= -X oras.land/oras/internal/version.Version={{.Version}} -X oras.land/oras/internal/version.GitCommit={{.FullCommit}} -X oras.land/oras/internal/version.BuildMetadata= -X oras.land/oras/internal/version.GitTreeState=clean
mod_timestamp: "{{ .CommitTimestamp }}"

archives:
- format: tar.gz
Expand Down

0 comments on commit bdc9b48

Please sign in to comment.