add binary build workflow and hook policy

This commit is contained in:
Jabberwocky238
2026-07-30 01:07:37 -04:00
parent 319f5dd148
commit 0588c85b8f
6 changed files with 93 additions and 127 deletions
+55
View File
@@ -0,0 +1,55 @@
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