From 6fc4ead7ec3e35221b02b669922fc24e8f6aab0d Mon Sep 17 00:00:00 2001 From: Daniel Sukoneck Date: Wed, 24 Jan 2024 19:31:05 -0700 Subject: [PATCH] add image release workflow --- .github/CODEOWNERS | 26 ++------ .github/workflows/release.yml | 35 +++++++++++ .goreleaser.yaml | 111 ++++++++++++++++++++++++++++++++++ Dockerfile.suave | 7 +++ Makefile | 13 ++++ 5 files changed, 170 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml create mode 100644 Dockerfile.suave diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index faf922df01..7c5e34984c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,22 +1,4 @@ -# Lines starting with '#' are comments. -# Each line is a file pattern followed by one or more owners. - -accounts/usbwallet @karalabe -accounts/scwallet @gballet -accounts/abi @gballet @MariusVanDerWijden -cmd/clef @holiman -consensus @karalabe -core/ @karalabe @holiman @rjl493456442 -eth/ @karalabe @holiman @rjl493456442 -eth/catalyst/ @gballet -eth/tracers/ @s1na -graphql/ @s1na -les/ @zsfelfoldi @rjl493456442 -light/ @zsfelfoldi @rjl493456442 -node/ @fjl -p2p/ @fjl @zsfelfoldi -rpc/ @fjl @holiman -p2p/simulations @fjl -p2p/protocols @fjl -p2p/testing @fjl -signer/ @holiman +# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, +# they will be requested for review when someone opens a pull request. +* @ferranbt @Ruteri @metachris @dmarzzz @lthibault diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..57cabb8a3c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +# .github/workflows/release.yml +name: release + +on: + workflow_dispatch: + push: + tags: + - "*" + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: setup dependencies + uses: actions/setup-go@v2 + + - name: Login to Docker hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Log tag name + run: echo "Build for tag ${{ github.ref_name }}" + + - name: Create release + run: make release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000000..f04ae9991b --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,111 @@ +env: + - CGO_ENABLED=1 +builds: + - id: suave-execution-geth-darwin-amd64 + binary: suave-execution-geth + main: ./cmd/geth + goarch: + - amd64 + goos: + - darwin + env: + - CC=o64-clang + - CXX=o64-clang++ + flags: + - -trimpath + - id: suave-execution-geth-darwin-arm64 + binary: suave-execution-geth + main: ./cmd/geth + goarch: + - arm64 + goos: + - darwin + env: + - CC=oa64-clang + - CXX=oa64-clang++ + flags: + - -trimpath + - id: suave-execution-geth-linux-amd64 + binary: suave-execution-geth + main: ./cmd/geth + env: + - CC=x86_64-linux-gnu-gcc + - CXX=x86_64-linux-gnu-g++ + goarch: + - amd64 + goos: + - linux + flags: + - -trimpath + ldflags: + - -extldflags "-Wl,-z,stack-size=0x800000 --static" + tags: + - netgo + - osusergo + - id: suave-execution-geth-linux-arm64 + binary: suave-execution-geth + main: ./cmd/geth + goarch: + - arm64 + goos: + - linux + env: + - CC=aarch64-linux-gnu-gcc + - CXX=aarch64-linux-gnu-g++ + flags: + - -trimpath + ldflags: + - -extldflags "-Wl,-z,stack-size=0x800000 --static" + tags: + - netgo + - osusergo + - id: suave-execution-geth-windows-amd64 + binary: suave-execution-geth + main: ./cmd/geth + goarch: + - amd64 + goos: + - windows + env: + - CC=x86_64-w64-mingw32-gcc + - CXX=x86_64-w64-mingw32-g++ + flags: + - -trimpath + - -buildmode=exe + +archives: + - id: w/version + builds: + - suave-execution-geth-darwin-amd64 + - suave-execution-geth-darwin-arm64 + - suave-execution-geth-linux-amd64 + - suave-execution-geth-linux-arm64 + - suave-execution-geth-windows-amd64 + name_template: "suave-execution-geth_v{{ .Version }}_{{ .Os }}_{{ .Arch }}" + wrap_in_directory: false + format: zip + files: + - none* + +dockers: + - dockerfile: ./Dockerfile.suave + use: buildx + goarch: amd64 + goos: linux + build_flag_templates: + - --platform=linux/amd64 + image_templates: + - "flashbots/suave-execution-geth:{{ .ShortCommit }}" + - "flashbots/suave-execution-geth:{{ .Tag }}" + - "flashbots/suave-execution-geth:latest" + +checksum: + name_template: "checksums.txt" + +release: + draft: true + header: | + # 🚀 Features + # 🎄 Enhancements + # 🐞 Notable bug fixes + # 🎠 Community diff --git a/Dockerfile.suave b/Dockerfile.suave new file mode 100644 index 0000000000..b3b6f40619 --- /dev/null +++ b/Dockerfile.suave @@ -0,0 +1,7 @@ +FROM debian:bullseye +LABEL "org.opencontainers.image.source"="https://github.com/flashbots/suave-execution-geth" + +COPY ./suave-execution-geth /bin/ + +EXPOSE 8545 8546 30303 30303/udp +ENTRYPOINT ["suave-execution-geth"] diff --git a/Makefile b/Makefile index d736ef61c0..fbcbd804dd 100644 --- a/Makefile +++ b/Makefile @@ -36,3 +36,16 @@ devtools: env GOBIN= go install ./cmd/abigen @type "solc" 2> /dev/null || echo 'Please install solc' @type "protoc" 2> /dev/null || echo 'Please install protoc' + +release: + docker run \ + --rm \ + -e CGO_ENABLED=1 \ + -e GITHUB_TOKEN="$(GITHUB_TOKEN)" \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v $(HOME)/.docker/config.json:/root/.docker/config.json \ + -v `pwd`:/go/src/$(PACKAGE_NAME) \ + -v `pwd`/sysroot:/sysroot \ + -w /go/src/$(PACKAGE_NAME) \ + ghcr.io/goreleaser/goreleaser-cross:v1.19.5 \ + release --clean