Skip to content

Commit

Permalink
chore: update build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rayanebel committed Jan 8, 2025
1 parent 7bca713 commit 26d4ca2
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,58 @@ env:
REGISTRY: oci://ghcr.io/kilnfi/charts

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
arch: [amd64, arm64]
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Export Variables
id: export-variables
run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
echo "os_name=linux" >> $GITHUB_OUTPUT
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
echo "os_name=darwin" >> $GITHUB_OUTPUT
elif [ "${{ matrix.os }}" = "windows-latest" ]; then
echo "os_name=windows" >> $GITHUB_OUTPUT
fi
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- name: Install dependencies on macOS
if: runner.os == 'macOS'
run: |
brew update
brew install sqlite
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Build binary
run: |
mkdir -p dist
ARCH_NAME=${{ matrix.arch }}
OUTPUT_FILE="cardano-validator-watcher_${{ github.ref_name }}_${{ steps.export-variables.outputs.os_name }}_${ARCH_NAME}"
CGO_ENABLED=1 \
GOOS=${{ steps.export-variables.outputs.os_name }} \
GOARCH=$ARCH_NAME \
go build -ldflags="-s -w" -o dist/${OUTPUT_FILE}
tar -czvf dist/${OUTPUT_FILE}.tar.gz -C dist/ ${OUTPUT_FILE}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*.tar.gz
tag: ${{ github.ref }}

binaries:
runs-on: ubuntu-latest
container:
Expand Down

0 comments on commit 26d4ca2

Please sign in to comment.