-
Notifications
You must be signed in to change notification settings - Fork 172
96 lines (84 loc) · 3.23 KB
/
build.yml
File metadata and controls
96 lines (84 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build
on:
workflow_dispatch:
push:
branches:
- main
- feat/krakatoa
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
timeout-minutes: 15
runs-on: depot-ubuntu-22.04-4
strategy:
fail-fast: false
matrix:
goarch: [amd64, arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for git describe to get version tags
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
check-latest: true
cache: true
cache-dependency-path: |
go.sum
evmd/go.sum
- name: Get version info
id: version
shell: bash
run: |
VERSION=$(git describe --tags --always | sed 's/^v//')
COMMIT=$(git log -1 --format='%H')
COMMIT_SHORT=$(git log -1 --format='%h')
TMVERSION=$(go list -m github.com/cometbft/cometbft | sed 's:.* ::')
BRANCH_NAME=$(echo "${{ github.ref_name }}" | sed 's|/|-|g')
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "commit=${COMMIT}" >> "$GITHUB_OUTPUT"
echo "commit_short=${COMMIT_SHORT}" >> "$GITHUB_OUTPUT"
echo "tmversion=${TMVERSION}" >> "$GITHUB_OUTPUT"
echo "branch=${BRANCH_NAME}" >> "$GITHUB_OUTPUT"
- name: Build evmd
working-directory: evmd
env:
GOOS: linux
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "1"
shell: bash
run: |
BINARY_NAME="evmd-${{ steps.version.outputs.branch }}-${{ steps.version.outputs.commit_short }}-linux-${{ matrix.goarch }}"
go build \
-trimpath \
-tags "netgo" \
-ldflags "-w -s \
-X github.com/cosmos/cosmos-sdk/version.Name=evmd \
-X github.com/cosmos/cosmos-sdk/version.AppName=evmd \
-X github.com/cosmos/cosmos-sdk/version.Version=${{ steps.version.outputs.version }} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${{ steps.version.outputs.commit }} \
-X github.com/cometbft/cometbft/version.TMCoreSemVer=${{ steps.version.outputs.tmversion }} \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo" \
-o "${BINARY_NAME}" \
./cmd/evmd
- name: Generate checksum
working-directory: evmd
shell: bash
run: |
BINARY_NAME="evmd-${{ steps.version.outputs.branch }}-${{ steps.version.outputs.commit_short }}-linux-${{ matrix.goarch }}"
sha256sum "${BINARY_NAME}" > "${BINARY_NAME}.sha256"
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: evmd-${{ steps.version.outputs.branch }}-${{ steps.version.outputs.commit_short }}-linux-${{ matrix.goarch }}
path: |
evmd/evmd-${{ steps.version.outputs.branch }}-${{ steps.version.outputs.commit_short }}-linux-${{ matrix.goarch }}
evmd/evmd-${{ steps.version.outputs.branch }}-${{ steps.version.outputs.commit_short }}-linux-${{ matrix.goarch }}.sha256
retention-days: 30
if-no-files-found: error