Skip to content

Commit

Permalink
start goreleaser (flashbots#289)
Browse files Browse the repository at this point in the history
* start goreleaser

* try setup from franciscodiazydiaz/mev-boost
  • Loading branch information
metachris authored Sep 13, 2022
1 parent e9f8e45 commit 17ea47b
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 12 deletions.
110 changes: 99 additions & 11 deletions .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- 'v*'

permissions:
contents: write

jobs:
docker-image:
name: Publish Docker Image
Expand Down Expand Up @@ -52,19 +55,104 @@ jobs:
tags: flashbots/mev-boost:latest-portable,flashbots/mev-boost:${{ steps.vars.outputs.tag }}-portable
platforms: linux/amd64,linux/arm64

github-release:
build-linux-windows:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Install cross-compiler for linux/arm64 and windows
run: sudo apt-get -y install gcc-aarch64-linux-gnu gcc-mingw-w64
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --skip-publish --config .goreleaser-linux_windows.yaml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: mev-boost-linux_windows
path: |
dist/mev-boost*.tar.gz
dist/mev-boost*.txt
- name: Create release
id: create_release
uses: actions/create-release@v1
build-darwin:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --skip-publish --config .goreleaser-darwin.yaml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: mev-boost-darwin
path: |
dist/mev-boost*.tar.gz
dist/mev-boost*.txt
release:
needs: [build-linux-windows, build-darwin]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Make directories
run: |
mkdir -p ./build/linux_windows
mkdir -p ./build/darwin
- name: Download Linux and Windows binaries
uses: actions/download-artifact@v3
with:
name: mev-boost-linux_windows
path: ./build/linux_windows
- name: Download Darwin binaries
uses: actions/download-artifact@v3
with:
name: mev-boost-darwin
path: ./build/darwin
- name: Merge checksum file
run: |
cd ./build
cat ./darwin/mev-boost*checksums.txt >> checksums.txt
cat ./linux_windows/mev-boost*checksums.txt >> checksums.txt
rm ./darwin/mev-boost*checksums.txt
rm ./linux_windows/mev-boost*checksums.txt
- name: Release
uses: goreleaser/goreleaser-action@v3
with:
args: release --config .goreleaser-release.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
/mev-boost
/test-cli
/tmp
/dist
.vscode/
/README.internal.md
/validator_data.json
/validator_data.json
/build/
14 changes: 14 additions & 0 deletions .goreleaser-darwin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
project_name: mev-boost
builds:
- id: mev-boost-portable
ldflags:
- -X github.com/flashbots/mev-boost/config.Version={{.Version}}
env:
- CGO_ENABLED=1
- CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__"
- CGO_CFLAGS="-D__BLST_PORTABLE__"
goos:
- darwin
goarch:
- amd64
- arm64
41 changes: 41 additions & 0 deletions .goreleaser-linux_windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
project_name: mev-boost
builds:
- id: mev-boost-portable
ldflags:
- -X github.com/flashbots/mev-boost/config.Version={{.Version}}
env:
- CGO_ENABLED=1
- CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__"
- CGO_CFLAGS="-D__BLST_PORTABLE__"
goos:
- linux
- windows
goarch:
- amd64
- arm64

# List of combinations of GOOS + GOARCH + GOARM to ignore.
# Default is empty.
ignore:
- goos: windows
goarch: arm64

# Overrides allows to override some fields for specific targets.
# This can be specially useful when using CGO.
# Note: it'll only match if the full target matches.
overrides:
- goos: linux
goarch: arm64
env:
- CGO_ENABLED=1
- CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__"
- CGO_CFLAGS="-D__BLST_PORTABLE__"
- CC=aarch64-linux-gnu-gcc
- goos: windows
goarch: amd64
goamd64: v1
env:
- CGO_ENABLED=1
- CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__"
- CGO_CFLAGS="-D__BLST_PORTABLE__"
- CC=x86_64-w64-mingw32-gcc
7 changes: 7 additions & 0 deletions .goreleaser-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
builds:
- skip: true
release:
draft: true
extra_files:
- glob: ./build/**/*
- glob: ./build/checksums.txt

0 comments on commit 17ea47b

Please sign in to comment.