56 lines
1.3 KiB
YAML
56 lines
1.3 KiB
YAML
name: Build binaries
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
name: Build ${{ matrix.goos }}-${{ matrix.goarch }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- goos: linux
|
|
goarch: amd64
|
|
suffix: ""
|
|
- goos: darwin
|
|
goarch: amd64
|
|
suffix: ""
|
|
- goos: windows
|
|
goarch: amd64
|
|
suffix: .exe
|
|
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: Test
|
|
run: go test ./...
|
|
|
|
- name: Build
|
|
env:
|
|
CGO_ENABLED: "0"
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
run: go build -trimpath -ldflags="-s -w" -o "dist/simplegit-${GOOS}-${GOARCH}${{ matrix.suffix }}" ./cmd
|
|
|
|
- name: Upload binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: simplegit-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
path: dist/simplegit-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}
|
|
if-no-files-found: error
|
|
retention-days: 14
|