Changed the GitHub Build system to produce artifacts and build for macOS and Linux (arm64 and amd64)

This commit is contained in:
Alexandre 2025-01-30 20:59:28 +01:00
parent 99e69acba1
commit bb4266bcba

View File

@ -1,6 +1,3 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go name: Go
on: on:
@ -10,7 +7,6 @@ on:
branches: ["main"] branches: ["main"]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -19,10 +15,40 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: '1.23.5' go-version: "1.23.5"
- name: Build - name: Build
run: go build -v ./... run: go build -v ./...
- name: Test - name: Test
run: go test -v ./... run: go test -v ./...
build-multiarch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23.5"
- name: Build binaries for multiple architectures
run: |
mkdir -p dist
# Linux
GOOS=linux GOARCH=amd64 go build -o dist/gosh-linux-amd64
GOOS=linux GOARCH=arm64 go build -o dist/gosh-linux-arm64
# macOS
GOOS=darwin GOARCH=amd64 go build -o dist/gosh-mac-amd64
GOOS=darwin GOARCH=arm64 go build -o dist/gosh-mac-arm64
ls -lh dist/
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: gosh-binaries
path: dist/