Skip to content

Commit 92b93ec

Browse files
committed
feat: use reproducible builds
1 parent 8c453b1 commit 92b93ec

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ jobs:
5353
goarm: ${{ matrix.goarm }}
5454
project_path: '.'
5555
binary_name: ${{ github.event.repository.name }}
56-
ldflags: '-s -w -X main.ver=${{ needs.release-pr.outputs.version }}'
56+
pre_command: 'export CGO_ENABLED=0'
57+
build_flags: '-trimpath' # Reproducible build (also needs -buildid= in ldflags).
58+
ldflags: '-s -w -buildid= -X main.ver=${{ needs.release-pr.outputs.version }}'
5759
executable_compression: upx
5860
md5sum: false
5961
compress_assets: 'OFF'
@@ -136,8 +138,8 @@ jobs:
136138
PLATFORMS+=("$platform")
137139
done
138140
139-
echo "Building for platforms: ${PLATFORMS[*]}"
140-
141+
SOURCE_DATE_EPOCH="$(git log -1 --pretty=%ct)" # Reproducible build.
142+
export SOURCE_DATE_EPOCH
141143
docker buildx build \
142144
--platform "$(IFS=, ; echo "${PLATFORMS[*]}")" \
143145
--build-arg GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" \

0 commit comments

Comments
 (0)