Chore: github action to build and push container image to ghcr.io (#10) #5
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 Binaries | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
name: Build Release Assets | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Add more platforms as needed | |
goos: [linux, darwin, windows] | |
goarch: [amd64, arm64] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/go/bin | |
key: ${{ runner.os }}-go-${{ matrix.goos }}-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ matrix.goos }}-${{ matrix.goarch }} | |
- name: Build binary | |
run: | | |
mkdir -p dist | |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/${{ github.event.repository.name }}_${{ matrix.goos }}_${{ matrix.goarch }} . | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binaries | |
path: dist/ |