mirror of
https://github.com/skoelle/kctl-tui.git
synced 2026-09-17 20:10:24 +00:00
- Upgrade go-version from 1.24 to 1.25 in build.yml (required by go-selfupdate v1.6.0) - Add kctl-tui update command and interactive startup check to README.md - Document new features in CHANGELOG.md - Update Go version requirement to 1.25+ in README.md and CONTRIBUTING.md - Add Phase 5 (Self-update) to PLAN.md roadmap
102 lines
2.3 KiB
YAML
102 lines
2.3 KiB
YAML
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@v7
|
|
|
|
- uses: actions/setup-go@v7
|
|
with:
|
|
go-version: "1.25"
|
|
cache: false
|
|
|
|
- name: Tidy dependencies (generates/updates go.sum)
|
|
run: go mod tidy
|
|
|
|
- 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@v7
|
|
|
|
- uses: actions/setup-go@v7
|
|
with:
|
|
go-version: "1.25"
|
|
cache: false
|
|
|
|
- name: Tidy dependencies (generates/updates go.sum)
|
|
run: go mod tidy
|
|
|
|
- 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 -X main.version=${GITHUB_REF_NAME}" ./cmd/kctl-tui
|
|
echo "Built $out"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v7
|
|
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/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Extract release notes from commit message
|
|
id: release
|
|
run: |
|
|
MSG=$(git log -1 --pretty=format:"%B" "${{ github.sha }}")
|
|
{
|
|
echo 'body<<EOF'
|
|
echo "$MSG"
|
|
echo 'EOF'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
- name: Create release and upload binaries
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
body: ${{ steps.release.outputs.body }}
|
|
files: dist/*
|