File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ VERSION=" ${1:- dev} "
5+ DIST_DIR=" ${2:- dist} "
6+
7+ EXAMPLES=(
8+ " basic-authorization"
9+ " transaction-batching"
10+ " send-userop"
11+ )
12+
13+ TARGETS=(
14+ " linux/amd64"
15+ " linux/arm64"
16+ " darwin/amd64"
17+ " darwin/arm64"
18+ " windows/amd64"
19+ )
20+
21+ rm -rf " ${DIST_DIR} "
22+ mkdir -p " ${DIST_DIR} "
23+
24+ for target in " ${TARGETS[@]} " ; do
25+ IFS=' /' read -r GOOS GOARCH <<< " ${target}"
26+ stage_dir=" ${DIST_DIR} /stage-${GOOS} -${GOARCH} "
27+ mkdir -p " ${stage_dir} "
28+
29+ for example in " ${EXAMPLES[@]} " ; do
30+ output_name=" ${example} "
31+ if [[ " ${GOOS} " == " windows" ]]; then
32+ output_name+=" .exe"
33+ fi
34+
35+ CGO_ENABLED=0 GOOS=" ${GOOS} " GOARCH=" ${GOARCH} " \
36+ go build -trimpath -ldflags " -s -w" \
37+ -o " ${stage_dir} /${output_name} " " ./examples/${example} "
38+ done
39+
40+ archive_path=" ${DIST_DIR} /eip7702-go_${VERSION} _${GOOS} _${GOARCH} .tar.gz"
41+ tar -C " ${stage_dir} " -czf " ${archive_path} " .
42+ rm -rf " ${stage_dir} "
43+ echo " Built ${archive_path} "
44+ done
45+
46+ if command -v sha256sum > /dev/null 2>&1 ; then
47+ (
48+ cd " ${DIST_DIR} "
49+ sha256sum ./* .tar.gz > checksums.txt
50+ )
51+ else
52+ (
53+ cd " ${DIST_DIR} "
54+ shasum -a 256 ./* .tar.gz > checksums.txt
55+ )
56+ fi
57+
58+ echo " Release artifacts are available in ${DIST_DIR} /"
You can’t perform that action at this time.
0 commit comments