Files
kandev/.github/workflows/release.yml
T
2026-02-16 10:52:46 +00:00

139 lines
4.4 KiB
YAML

name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: "9"
- uses: actions/setup-node@v6
with:
node-version: "24"
- name: Install dependencies
run: pnpm -C apps install --frozen-lockfile
- name: Build web (standalone)
run: pnpm -C apps --filter @kandev/web build
- name: Package web bundle
run: bash scripts/release/package-web.sh
- uses: actions/upload-artifact@v4
with:
name: web-bundle
path: dist/web
build-bundles:
needs: build-web
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux-x64
goos: linux
goarch: amd64
- os: ubuntu-latest
platform: linux-arm64
goos: linux
goarch: arm64
cc: aarch64-linux-gnu-gcc
- os: macos-15-large
platform: macos-x64
goos: darwin
goarch: amd64
- os: macos-14
platform: macos-arm64
goos: darwin
goarch: arm64
- os: windows-latest
platform: windows-x64
goos: windows
goarch: amd64
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 1
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v6
with:
go-version-file: apps/backend/go.mod
cache-dependency-path: apps/backend/go.sum
- uses: actions/download-artifact@v4
with:
name: web-bundle
path: dist/web
- name: Install cross-compilation tools (linux-arm64)
if: matrix.platform == 'linux-arm64'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build backend binaries (unix)
if: runner.os != 'Windows'
env:
CC: ${{ matrix.cc || '' }}
run: |
cd apps/backend
mkdir -p bin
go build -o bin/kandev ./cmd/kandev
go build -o bin/agentctl ./cmd/agentctl
- name: Build backend binaries (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# Ensure MSYS2 MinGW gcc is available for CGO
$env:Path = "C:\msys64\mingw64\bin;" + $env:Path
gcc --version
Set-Location apps/backend
New-Item -ItemType Directory -Force -Path bin | Out-Null
go build -o bin/kandev.exe ./cmd/kandev
go build -o bin/agentctl.exe ./cmd/agentctl
- name: Package bundle (unix)
if: runner.os != 'Windows'
run: |
rm -rf dist/kandev
mkdir -p dist/kandev/bin
cp apps/backend/bin/kandev dist/kandev/bin/
cp apps/backend/bin/agentctl dist/kandev/bin/
mkdir -p dist/kandev/web
cp -R dist/web/. dist/kandev/web/
cd dist
tar -czf "kandev-${{ matrix.platform }}.tar.gz" kandev
shasum -a 256 "kandev-${{ matrix.platform }}.tar.gz" > "kandev-${{ matrix.platform }}.tar.gz.sha256"
- name: Package bundle (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Remove-Item -Recurse -Force dist/kandev -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path dist/kandev/bin | Out-Null
Copy-Item apps/backend/bin/kandev.exe dist/kandev/bin/
Copy-Item apps/backend/bin/agentctl.exe dist/kandev/bin/
New-Item -ItemType Directory -Force -Path dist/kandev/web | Out-Null
# -Force on Get-ChildItem includes dot-prefixed items (.next/)
Get-ChildItem dist/web -Force | Copy-Item -Destination dist/kandev/web/ -Recurse -Force
cd dist
tar -czf "kandev-${{ matrix.platform }}.tar.gz" kandev
$hash = Get-FileHash "kandev-${{ matrix.platform }}.tar.gz" -Algorithm SHA256
"$($hash.Hash) kandev-${{ matrix.platform }}.tar.gz" | Out-File -FilePath "kandev-${{ matrix.platform }}.tar.gz.sha256" -Encoding ascii
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
dist/kandev-${{ matrix.platform }}.tar.gz
dist/kandev-${{ matrix.platform }}.tar.gz.sha256