Skip to content

Commit

Permalink
Set versioning build flags in the goreleaser (#131)
Browse files Browse the repository at this point in the history
* added versioning flags

* comment fix

---------

Co-authored-by: Stefan Negovanović <[email protected]>
  • Loading branch information
dusannosovic-ethernal and Stefan-Ethernal authored Mar 12, 2024
1 parent b216756 commit c85df85
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ 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 }}'
-X 'github.com/0xPolygon/polygon-edge/versioning.Commit={{ .Commit }}'
-X 'github.com/0xPolygon/polygon-edge/versioning.Branch={{ .Branch }}'
-X 'github.com/0xPolygon/polygon-edge/versioning.BuildTime={{ .Date }}'

- id: darwin-arm64
main: ./main.go
Expand All @@ -30,7 +34,11 @@ builds:
- 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 }}'
-X 'github.com/0xPolygon/polygon-edge/versioning.Commit={{ .Commit }}'
-X 'github.com/0xPolygon/polygon-edge/versioning.Branch={{ .Branch }}'
-X 'github.com/0xPolygon/polygon-edge/versioning.BuildTime={{ .Date }}'

- id: linux-amd64
main: ./main.go
Expand All @@ -44,7 +52,11 @@ 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 }}'
-linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Commit={{ .Commit }}'
-linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Branch={{ .Branch }}'
-linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.BuildTime={{ .Date }}'
tags:
- netgo
- osusergo
Expand All @@ -61,7 +73,11 @@ 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 }}'
-linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Commit={{ .Commit }}'
-linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.Branch={{ .Branch }}'
-linkmode external -extldflags "-static" -X 'github.com/0xPolygon/polygon-edge/versioning.BuildTime={{ .Date }}'
tags:
- netgo
- osusergo
Expand Down Expand Up @@ -110,3 +126,4 @@ docker_manifests:
- DOCKERHUB_ORGANIZATION/{{ .ProjectName }}:{{ .Version }}-amd64
- DOCKERHUB_ORGANIZATION/{{ .ProjectName }}:{{ .Version }}-arm64
skip_push: auto

0 comments on commit c85df85

Please sign in to comment.