Skip to content

Commit

Permalink
Merge pull request onflow#328 from onflow/implement-web3-client-version
Browse files Browse the repository at this point in the history
Return the released version in `web3_clientVersion`
  • Loading branch information
devbugging authored Jul 1, 2024
2 parents 07940bf + 39fa142 commit 9ee61c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: "Build & Push EVM Gateway Image to Public Repo"

on:
push:
branches:
- main
tags:
- '*'

env:
DOCKER_IMAGE_URL: ${{ vars.REPO_DOCKER_IMAGE_URL }}:${{ github.sha }}
Expand All @@ -15,7 +15,10 @@ jobs:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Google auth
id: auth
Expand All @@ -33,5 +36,5 @@ jobs:
- name: Docker Auth
run: |-
gcloud auth configure-docker ${{ vars.GAR_LOCATION }}-docker.pkg.dev
docker build -t ${{ env.DOCKER_IMAGE_URL }} --file Dockerfile .
docker build -t ${{ env.DOCKER_IMAGE_URL }} --build-arg GATEWAY_VERSION=$(git describe --tags --abbrev=0 2>/dev/null) --file Dockerfile .
docker push ${{ env.DOCKER_IMAGE_URL }}
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

FROM golang:1.20.0 as app-builder

ARG GATEWAY_VERSION="v0.1.0"

# Build the app binary in /app
WORKDIR /app

Expand All @@ -13,7 +15,7 @@ RUN go mod download
RUN go mod verify

# Build binary
RUN CGO_ENABLED=1 go build -o bin ./cmd/main/main.go
RUN CGO_ENABLED=1 go build -o bin -ldflags="-X github.com/onflow/flow-evm-gateway/api.Version=${GATEWAY_VERSION}" ./cmd/main/main.go
RUN chmod a+x bin

# RUN APP
Expand Down
6 changes: 5 additions & 1 deletion api/web3.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package api

import (
"fmt"

"github.com/onflow/go-ethereum/common/hexutil"
"github.com/onflow/go-ethereum/crypto"
)

var Version = "development"

// Web3API offers helper utils
type Web3API struct{}

// ClientVersion returns the node name
func (s *Web3API) ClientVersion() string {
return "flow-evm-gateway@v0.1.0"
return fmt.Sprintf("flow-evm-gateway@%s", Version)
}

// Sha3 applies the ethereum sha3 implementation on the input.
Expand Down

0 comments on commit 9ee61c6

Please sign in to comment.