Skip to content

Build

Build #81

Workflow file for this run

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