From cc5dd1f23c870f3e513d1902fe454449e8ca77d4 Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Fri, 26 Jul 2024 11:58:33 +0300 Subject: [PATCH 1/4] fix: use old binary for linux x64 --- packaging/pack.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/pack.rb b/packaging/pack.rb index a64a032e..1aa4a998 100755 --- a/packaging/pack.rb +++ b/packaging/pack.rb @@ -54,7 +54,7 @@ def put_binaries cd(__dir__) puts "Putting binaries to packages..." { - "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "npm/lefthook-linux-x64/bin/lefthook", + "#{DIST}/lefthook_linux_amd64_v1/lefthook" => "npm/lefthook-linux-x64/bin/lefthook", "#{DIST}/no_self_update_linux_arm64/lefthook" => "npm/lefthook-linux-arm64/bin/lefthook", "#{DIST}/no_self_update_freebsd_amd64_v1/lefthook" => "npm/lefthook-freebsd-x64/bin/lefthook", "#{DIST}/no_self_update_freebsd_arm64/lefthook" => "npm/lefthook-freebsd-arm64/bin/lefthook", @@ -68,7 +68,7 @@ def put_binaries end { - "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "npm-bundled/bin/lefthook-linux-x64/lefthook", + "#{DIST}/lefthook_linux_amd64_v1/lefthook" => "npm-bundled/bin/lefthook-linux-x64/lefthook", "#{DIST}/no_self_update_linux_arm64/lefthook" => "npm-bundled/bin/lefthook-linux-arm64/lefthook", "#{DIST}/no_self_update_freebsd_amd64_v1/lefthook" => "npm-bundled/bin/lefthook-freebsd-x64/lefthook", "#{DIST}/no_self_update_freebsd_arm64/lefthook" => "npm-bundled/bin/lefthook-freebsd-arm64/lefthook", @@ -82,7 +82,7 @@ def put_binaries end { - "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "rubygems/libexec/lefthook-linux-x64/lefthook", + "#{DIST}/lefthook_linux_amd64_v1/lefthook" => "rubygems/libexec/lefthook-linux-x64/lefthook", "#{DIST}/no_self_update_linux_arm64/lefthook" => "rubygems/libexec/lefthook-linux-arm64/lefthook", "#{DIST}/no_self_update_freebsd_amd64_v1/lefthook" => "rubygems/libexec/lefthook-freebsd-x64/lefthook", "#{DIST}/no_self_update_freebsd_arm64/lefthook" => "rubygems/libexec/lefthook-freebsd-arm64/lefthook", From 1d99caa09055e4f1a2e11a45a4991447720ed03a Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Fri, 26 Jul 2024 12:00:30 +0300 Subject: [PATCH 2/4] ci: goreleaser --verbose --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 403a2c80..ec7c4b1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,7 @@ jobs: with: distribution: goreleaser version: '~> v2' - args: release --clean + args: release --clean --verbose env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a18cae7..110bbef6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -76,7 +76,7 @@ jobs: with: distribution: goreleaser version: '~> v2' - args: release --snapshot --skip=publish --skip=snapcraft --skip=validate --clean + args: release --snapshot --skip=publish --skip=snapcraft --skip=validate --clean --verbose - name: Tar binaries to preserve executable bit run: 'tar -cvf lefthook-binaries.tar --directory dist/ $(find dist/ -executable -type f -printf "%P\0" | xargs --null)' - name: Upload binaries as artifacts From 4f7f40105aee7aa81763196e67b104582df3cc9e Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Fri, 26 Jul 2024 12:03:00 +0300 Subject: [PATCH 3/4] FIX: TYPO --- .goreleaser.yml | 8 +++----- packaging/pack.rb | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 1f7d56bc..743254c1 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -7,11 +7,9 @@ builds: # Builds the binaries without `lefthook upgrade` - id: no_self_update tags: - - osusergo - - netgo - no_self_update env: - - GCO_ENABLED=0 + - CGO_ENABLED=0 goos: - linux - darwin @@ -31,7 +29,7 @@ builds: flags: - -trimpath ldflags: - - -s -w -extldflags '-static' -X github.com/evilmartians/lefthook/internal/version.commit={{.Commit}} + - -s -w -X github.com/evilmartians/lefthook/internal/version.commit={{.Commit}} # Full lefthook binary - id: lefthook @@ -56,7 +54,7 @@ builds: flags: - -trimpath ldflags: - - -s -w -extldflags '-static' -X github.com/evilmartians/lefthook/internal/version.commit={{.Commit}} + - -s -w -X github.com/evilmartians/lefthook/internal/version.commit={{.Commit}} archives: - id: lefthook diff --git a/packaging/pack.rb b/packaging/pack.rb index 1aa4a998..15bc4ad1 100755 --- a/packaging/pack.rb +++ b/packaging/pack.rb @@ -54,7 +54,7 @@ def put_binaries cd(__dir__) puts "Putting binaries to packages..." { - "#{DIST}/lefthook_linux_amd64_v1/lefthook" => "npm/lefthook-linux-x64/bin/lefthook", + "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "npm/lefthook-linux-x64/bin/lefthook", "#{DIST}/no_self_update_linux_arm64/lefthook" => "npm/lefthook-linux-arm64/bin/lefthook", "#{DIST}/no_self_update_freebsd_amd64_v1/lefthook" => "npm/lefthook-freebsd-x64/bin/lefthook", "#{DIST}/no_self_update_freebsd_arm64/lefthook" => "npm/lefthook-freebsd-arm64/bin/lefthook", @@ -68,7 +68,7 @@ def put_binaries end { - "#{DIST}/lefthook_linux_amd64_v1/lefthook" => "npm-bundled/bin/lefthook-linux-x64/lefthook", + "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "npm-bundled/bin/lefthook-linux-x64/lefthook", "#{DIST}/no_self_update_linux_arm64/lefthook" => "npm-bundled/bin/lefthook-linux-arm64/lefthook", "#{DIST}/no_self_update_freebsd_amd64_v1/lefthook" => "npm-bundled/bin/lefthook-freebsd-x64/lefthook", "#{DIST}/no_self_update_freebsd_arm64/lefthook" => "npm-bundled/bin/lefthook-freebsd-arm64/lefthook", @@ -82,7 +82,7 @@ def put_binaries end { - "#{DIST}/lefthook_linux_amd64_v1/lefthook" => "rubygems/libexec/lefthook-linux-x64/lefthook", + "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "rubygems/libexec/lefthook-linux-x64/lefthook", "#{DIST}/no_self_update_linux_arm64/lefthook" => "rubygems/libexec/lefthook-linux-arm64/lefthook", "#{DIST}/no_self_update_freebsd_amd64_v1/lefthook" => "rubygems/libexec/lefthook-freebsd-x64/lefthook", "#{DIST}/no_self_update_freebsd_arm64/lefthook" => "rubygems/libexec/lefthook-freebsd-arm64/lefthook", From 00213dae625a0271ee5c4ed7c2787233893ec24e Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Fri, 26 Jul 2024 12:04:45 +0300 Subject: [PATCH 4/4] revert: static link flags --- Makefile | 4 ++-- packaging/pack.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 192170d6..e73c1409 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ COMMIT_HASH = $(shell git rev-parse HEAD) build: - go build -ldflags "-s -w -extldflags '-static' -X github.com/evilmartians/lefthook/internal/version.commit=$(COMMIT_HASH)" -o lefthook + go build -ldflags "-s -w -X github.com/evilmartians/lefthook/internal/version.commit=$(COMMIT_HASH)" -o lefthook build-with-coverage: - go build -cover -ldflags "-s -w extldflags '-static' -X github.com/evilmartians/lefthook/internal/version.commit=$(COMMIT_HASH)" -o lefthook + go build -cover -ldflags "-s -w -X github.com/evilmartians/lefthook/internal/version.commit=$(COMMIT_HASH)" -o lefthook install: build cp lefthook $$(go env GOPATH)/bin diff --git a/packaging/pack.rb b/packaging/pack.rb index 15bc4ad1..a64a032e 100755 --- a/packaging/pack.rb +++ b/packaging/pack.rb @@ -54,7 +54,7 @@ def put_binaries cd(__dir__) puts "Putting binaries to packages..." { - "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "npm/lefthook-linux-x64/bin/lefthook", + "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "npm/lefthook-linux-x64/bin/lefthook", "#{DIST}/no_self_update_linux_arm64/lefthook" => "npm/lefthook-linux-arm64/bin/lefthook", "#{DIST}/no_self_update_freebsd_amd64_v1/lefthook" => "npm/lefthook-freebsd-x64/bin/lefthook", "#{DIST}/no_self_update_freebsd_arm64/lefthook" => "npm/lefthook-freebsd-arm64/bin/lefthook", @@ -68,7 +68,7 @@ def put_binaries end { - "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "npm-bundled/bin/lefthook-linux-x64/lefthook", + "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "npm-bundled/bin/lefthook-linux-x64/lefthook", "#{DIST}/no_self_update_linux_arm64/lefthook" => "npm-bundled/bin/lefthook-linux-arm64/lefthook", "#{DIST}/no_self_update_freebsd_amd64_v1/lefthook" => "npm-bundled/bin/lefthook-freebsd-x64/lefthook", "#{DIST}/no_self_update_freebsd_arm64/lefthook" => "npm-bundled/bin/lefthook-freebsd-arm64/lefthook", @@ -82,7 +82,7 @@ def put_binaries end { - "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "rubygems/libexec/lefthook-linux-x64/lefthook", + "#{DIST}/no_self_update_linux_amd64_v1/lefthook" => "rubygems/libexec/lefthook-linux-x64/lefthook", "#{DIST}/no_self_update_linux_arm64/lefthook" => "rubygems/libexec/lefthook-linux-arm64/lefthook", "#{DIST}/no_self_update_freebsd_amd64_v1/lefthook" => "rubygems/libexec/lefthook-freebsd-x64/lefthook", "#{DIST}/no_self_update_freebsd_arm64/lefthook" => "rubygems/libexec/lefthook-freebsd-arm64/lefthook",