Add CI workflow, install.sh, and example config

This commit is contained in:
Stefan Koelle
2026-08-09 11:25:00 +02:00
parent c9ec4a1a77
commit 24edb42dfc
3 changed files with 168 additions and 0 deletions
+85
View File
@@ -0,0 +1,85 @@
name: Build and Test
on:
push:
branches: [ "main" ]
tags: [ "v*" ]
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Download dependencies
run: go mod download
- name: Vet
run: go vet ./...
- name: Run tests
run: go test ./... -v -cover
build:
name: Build binaries
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Download dependencies
run: go mod download
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
mkdir -p dist
ext=""
if [ "${{ matrix.goos }}" = "windows" ]; then ext=".exe"; fi
out="dist/kctl-tui-${{ matrix.goos }}-${{ matrix.goarch }}${ext}"
go build -o "$out" -ldflags "-s -w" ./cmd/kctl-tui
echo "Built $out"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: kctl-tui-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/*
release:
name: Attach binaries to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create release and upload binaries
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true