Build validator binary #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build validator binary | |
on: | |
workflow_dispatch: | |
inputs: | |
bech32_prefix: | |
required: false | |
type: string | |
default: "n" | |
wasmd_version: | |
required: true | |
type: string | |
app_name: | |
required: false | |
type: string | |
default: "nyxd" | |
release: | |
types: [created] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, ubuntu-20.04, macos-12] | |
runs-on: ${{ matrix.os }} | |
env: | |
BECH32_PREFIX: n | |
VERSION: v0.43.0 | |
APP_NAME: nyxd | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.10" | |
- name: Set up env vars (release) | |
if: github.event_name == 'release' | |
run: |- | |
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
echo "BECH32_PREFIX=${{ env.BECH32_PREFIX }}" >> $GITHUB_ENV | |
echo "APP_NAME=${{ env.APP_NAME }}" >> $GITHUB_ENV | |
- name: Set up env vars (workflow_dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: |- | |
echo "VERSION=${{ inputs.wasmd_version }}" >> $GITHUB_ENV | |
echo "BECH32_PREFIX=${{ inputs.bech32_prefix }}" >> $GITHUB_ENV | |
echo "APP_NAME=${{ inputs.app_name }}" >> $GITHUB_ENV | |
- name: Build | |
run: |- | |
echo "VERSION=$VERSION" | |
make build | |
- name: Copy libs (linux) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: |- | |
WASMVM_SO=$(ldd build/nyxd | grep "libwasmvm.*so" | awk '{ print $3 }') | |
cp $WASMVM_SO build | |
- name: Copy libs (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
run: |- | |
WASMVM_SO=$(otool -l build/nyxd | grep RPATH -A2 | tail -n 1 | awk '{ print $2 }') | |
cp $WASMVM_SO/libwasmvm.* build | |
- name: Show build output | |
run: |- | |
ls -lah build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nyxd-${{ matrix.os }} | |
path: build/* | |
- name: Bundle based on OS | |
run: |- | |
cd build | |
tar -czvf nyxd-${{ matrix.os }}.tar.gz * | |
- name: Upload to release based on tag name | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name == 'release' | |
with: | |
files: build/nyxd-${{ matrix.os }}.tar.gz |