Skip to content

fix(openai): abort print stream on signal #41

fix(openai): abort print stream on signal

fix(openai): abort print stream on signal #41

Workflow file for this run

name: Dev Release (main)
on:
push:
branches: [main]
concurrency:
group: dev-release-${{ github.ref }}
cancel-in-progress: false
jobs:
compute-version:
runs-on: ubuntu-latest
outputs:
dev_version: ${{ steps.version.outputs.dev_version }}
tag_name: ${{ steps.version.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.1'
- name: Compute dev version
id: version
run: |
BASE_VERSION=$(node -p "require('./package.json').version")
DEV_VERSION="${BASE_VERSION}-dev.${{ github.run_number }}"
echo "dev_version=${DEV_VERSION}" >> "${GITHUB_OUTPUT}"
echo "tag_name=v${DEV_VERSION}" >> "${GITHUB_OUTPUT}"
echo "Dev version: ${DEV_VERSION}"
build-binaries:
needs: compute-version
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-24.04-arm64
- os: macos-latest
- os: macos-13
- os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.1'
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install
run: bun install
- name: Build Linux seccomp assets (Unix socket blocking)
if: runner.os == 'Linux'
run: node scripts/build-seccomp-assets.mjs --require --verbose
- name: Stage seccomp assets for publishing
if: runner.os == 'Linux'
run: |
set -euo pipefail
ARCH="$(node -p 'process.arch')"
mkdir -p "seccomp-assets/linux-${ARCH}"
cp "vendor/seccomp/${ARCH}/apply-seccomp" "seccomp-assets/linux-${ARCH}/apply-seccomp"
cp "vendor/seccomp/${ARCH}/unix-block.bpf" "seccomp-assets/linux-${ARCH}/unix-block.bpf"
chmod 755 "seccomp-assets/linux-${ARCH}/apply-seccomp" || true
- name: Upload seccomp assets artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: seccomp-linux-${{ matrix.os }}
path: seccomp-assets/**
if-no-files-found: error
- name: Set package.json version (dev)
run: |
node - <<'NODE'
const fs = require('node:fs')
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'))
pkg.version = process.env.DEV_VERSION
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n')
NODE
env:
DEV_VERSION: ${{ needs.compute-version.outputs.dev_version }}
- name: Build (assets needed for standalone binary)
run: bun run build
- name: Ensure bundled ripgrep (current platform only)
run: bun run scripts/ensure-ripgrep.mjs --current-only
- name: Build binary
run: bun run build:binary
- name: Prepare release asset
id: asset
run: |
node - <<'NODE'
const fs = require('node:fs')
const path = require('node:path')
const platform = process.platform
const arch = process.arch
const ext = platform === 'win32' ? '.exe' : ''
const src = path.join('dist', 'bin', `${platform}-${arch}`, `kode${ext}`)
const dest = `kode-${platform}-${arch}${ext}`
fs.copyFileSync(src, dest)
if (platform !== 'win32') {
try { fs.chmodSync(dest, 0o755) } catch {}
}
fs.appendFileSync(process.env.GITHUB_OUTPUT, `asset=${dest}\n`)
console.log(`Prepared ${dest}`)
NODE
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.asset.outputs.asset }}
path: ${{ steps.asset.outputs.asset }}
if-no-files-found: error
prerelease:
needs: [compute-version, build-binaries]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download binary artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create checksums
run: |
find artifacts -type f -maxdepth 2 -print0 | sort -z | xargs -0 shasum -a 256 > checksums-sha256.txt
echo "Checksums:"
head -n 20 checksums-sha256.txt
- name: Create GitHub prerelease
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.compute-version.outputs.tag_name }}
name: ${{ needs.compute-version.outputs.tag_name }}
prerelease: true
files: |
artifacts/**/*
checksums-sha256.txt