Skip to content

Create binary.yml

Create binary.yml #1

Workflow file for this run

name: Build Go Code
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.19, 1.20] # Add the Go versions you want to support
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: go-actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Install Go dependencies
run: go mod download
- name: Build
run: |
GOOS=${{ matrix.os }}
GOARCH=${{ matrix.arch }}
echo "Building for GOOS=$GOOS GOARCH=$GOARCH"
mkdir -p builds/${GOOS}_${GOARCH}
go build -o builds/${GOOS}_${GOARCH}/myapp
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: myapp-${{ matrix.os }}-${{ matrix.arch }}
path: builds/${{ matrix.os }}_${{ matrix.arch }}/myapp