Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set versioning build flags in the goreleaser #131

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,26 @@ builds:
- CC=o64-clang
- CXX=o64-clang++
ldflags:
-s -w -X 'github.com/${GITHUB_REPOSITORY}/versioning.Version=v{{ .Version }}'
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Commit={{ .Commit }}'
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Branch={{ .Branch }}'
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.BuildTime={{ .Date }}'
dusannosovic-ethernal marked this conversation as resolved.
Show resolved Hide resolved

- id: darwin-arm64
main: ./main.go
binary: blade
goos:
main: ./main.go
binary: blade
goos:
dusannosovic-ethernal marked this conversation as resolved.
Show resolved Hide resolved
- darwin
goarch:
- arm64
env:
- CC=oa64-clang
- CXX=oa64-clang++
ldflags:
-s -w -X 'github.com/${GITHUB_REPOSITORY}/versioning.Version=v{{ .Version }}'
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Commit={{ .Commit }}'
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Branch={{ .Branch }}'
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.BuildTime={{ .Date }}'

- id: linux-amd64
main: ./main.go
Expand All @@ -44,7 +50,10 @@ builds:
- CXX=g++
ldflags:
# We need to build a static binary because we are building in a glibc based system and running in a musl container
-s -w -linkmode external -extldflags "-static" -X 'github.com/${GITHUB_REPOSITORY}/versioning.Version=v{{ .Version }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Commit={{ .Commit }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Branch={{ .Branch }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.BuildTime={{ .Date }}'
dusannosovic-ethernal marked this conversation as resolved.
Show resolved Hide resolved
tags:
- netgo
- osusergo
Expand All @@ -61,7 +70,10 @@ builds:
- CXX=aarch64-linux-gnu-g++
ldflags:
# We need to build a static binary because we are building in a glibc based system and running in a musl container
-s -w -linkmode external -extldflags "-static" -X 'github.com/${GITHUB_REPOSITORY}/versioning.Version=v{{ .Version }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Commit={{ .Commit }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Branch={{ .Branch }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.BuildTime={{ .Date }}'
tags:
- netgo
- osusergo
Expand Down Expand Up @@ -109,4 +121,4 @@ docker_manifests:
image_templates:
- DOCKERHUB_ORGANIZATION/{{ .ProjectName }}:{{ .Version }}-amd64
- DOCKERHUB_ORGANIZATION/{{ .ProjectName }}:{{ .Version }}-arm64
skip_push: auto
skip_push: auto
dusannosovic-ethernal marked this conversation as resolved.
Show resolved Hide resolved
Loading