60 lines
1.5 KiB
YAML
60 lines
1.5 KiB
YAML
name: Build binaries
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
name: Build binaries
|
|
runs-on: ubuntu-latest
|
|
|
|
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"
|
|
run: |
|
|
GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o dist/simplegit-linux-amd64 ./cmd
|
|
GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o dist/simplegit-darwin-amd64 ./cmd
|
|
GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o dist/simplegit-windows-amd64.exe ./cmd
|
|
|
|
- name: Upload Linux binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: simplegit-linux-amd64
|
|
path: dist/simplegit-linux-amd64
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
|
|
- name: Upload macOS binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: simplegit-darwin-amd64
|
|
path: dist/simplegit-darwin-amd64
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
|
|
- name: Upload Windows binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: simplegit-windows-amd64
|
|
path: dist/simplegit-windows-amd64.exe
|
|
if-no-files-found: error
|
|
retention-days: 14
|