-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add goreleaser #146
Add goreleaser #146
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,36 @@ | ||||||
# .github/workflows/release.yml | ||||||
name: goreleaser | ||||||
|
||||||
on: | ||||||
workflow_dispatch: | ||||||
push: | ||||||
tags: | ||||||
- "*" | ||||||
|
||||||
jobs: | ||||||
goreleaser: | ||||||
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 GHCR | ||||||
uses: docker/login-action@v2 | ||||||
with: | ||||||
registry: ghcr.io | ||||||
username: ${{ github.repository_owner }} | ||||||
password: ${{ secrets.GITHUB_TOKEN }} | ||||||
|
||||||
- name: Publich ref name | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to |
||||||
run: echo "Build for tag ${{ github.ref_name }}" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this work? in the past I've had to use this way: https://github.com/flashbots/mev-boost/blob/develop/.github/workflows/release.yaml#L20-L26 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, check this execution log https://github.com/ferranbt/suave-geth/actions/runs/7446372136/job/20256482872 |
||||||
|
||||||
- name: release dry run | ||||||
run: make release | ||||||
env: | ||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
TAG: ${{ github.ref_name }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
env: | ||
- CGO_ENABLED=1 | ||
builds: | ||
- id: suave-geth-darwin-amd64 | ||
binary: suave-geth | ||
main: ./cmd/geth | ||
goarch: | ||
- amd64 | ||
goos: | ||
- darwin | ||
env: | ||
- CC=o64-clang | ||
- CXX=o64-clang++ | ||
flags: | ||
- -trimpath | ||
- id: suave-geth-darwin-arm64 | ||
binary: suave-geth | ||
main: ./cmd/geth | ||
goarch: | ||
- arm64 | ||
goos: | ||
- darwin | ||
env: | ||
- CC=oa64-clang | ||
- CXX=oa64-clang++ | ||
flags: | ||
- -trimpath | ||
- id: suave-geth-linux-amd64 | ||
binary: suave-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 "-lc -lrt -lpthread --static" | ||
- id: suave-geth-linux-arm64 | ||
binary: suave-geth | ||
main: ./cmd/geth | ||
goarch: | ||
- arm64 | ||
goos: | ||
- linux | ||
env: | ||
- CC=aarch64-linux-gnu-gcc | ||
- CXX=aarch64-linux-gnu-g++ | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- -extldflags "-lc -lrt -lpthread --static" | ||
- id: suave-geth-windows-amd64 | ||
binary: suave-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-geth-darwin-amd64 | ||
- suave-geth-darwin-arm64 | ||
- suave-geth-linux-amd64 | ||
- suave-geth-linux-arm64 | ||
- suave-geth-windows-amd64 | ||
name_template: "suave-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: | ||
- "ghcr.io/flashbots/suave-geth:{{ .ShortCommit }}" | ||
- "ghcr.io/flashbots/suave-geth:{{ .Tag }}" | ||
- "ghcr.io/flashbots/suave-geth:latest" | ||
|
||
checksum: | ||
name_template: "checksums.txt" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## v0.1.0 (Unreleased) | ||
|
||
Initial release of `suave-geth`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,3 +54,21 @@ devnet-down: | |
|
||
fmt-contracts: | ||
cd suave && forge fmt | ||
|
||
release: | ||
# Generate the changelog for the release | ||
./suave/scripts/parse-changelog.sh $(TAG) > /tmp/changelog.md | ||
|
||
# Build and publish the release | ||
docker run \ | ||
--rm \ | ||
-e CGO_ENABLED=1 \ | ||
-e GITHUB_TOKEN="$(GITHUB_TOKEN)" \ | ||
-v /tmp/changelog.md:/build/changelog.md \ | ||
-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 --release-notes /build/changelog.md | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think it'd be better to create a draft release here, and manually edit the description and publish when ready |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
metachris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Define the version you want to extract | ||
target_version=$1 | ||
|
||
if [ -z "$target_version" ]; then | ||
echo "Target version is empty" | ||
exit 1 | ||
fi | ||
|
||
# Input changelog file | ||
changelog_file="CHANGELOG.md" | ||
|
||
# Function to add entries to the markdown file | ||
add_entry() { | ||
echo -e "$1" | ||
} | ||
|
||
# Flag to start processing when the target version is found | ||
found_version=false | ||
found_anything=false | ||
|
||
# Read the changelog file line by line | ||
while IFS= read -r line; do | ||
# Check if the line starts with the target version | ||
if [[ $line == "## $target_version"* ]]; then | ||
echo "## Changelog" | ||
found_version=true | ||
found_anything=true | ||
continue | ||
elif [[ $line == "## "* ]]; then | ||
# We moved to another version, stop processing | ||
found_version=false | ||
fi | ||
|
||
# If we've found the target version, start processing entries | ||
if [ "$found_version" = true ]; then | ||
# Add the current entry to the markdown file | ||
add_entry "$line" | ||
fi | ||
done < "$changelog_file" | ||
|
||
# If no changelog found, return an error | ||
if [ "$found_anything" = false ]; then | ||
echo "No changelog found for $target_version" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use docker hub, i'll help set this up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt?
probably docker hub is more common and easier to use, as you don't need to be logged into github (it's more easily accessible)
I've created https://hub.docker.com/r/flashbots/suave-geth and added env vars to the repo settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you set
DOCKERHUB_USERNAME
andDOCKERHUB_TOKEN
?