Skip to content

Release v0.6.1

Release v0.6.1 #18

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
pkg_version: ${{ steps.pkg-info.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Setup Node.js for npm publish
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Get package info
id: pkg-info
run: |
PKG_VERSION=$(node -p 'require("./package.json").version')
echo "version=${PKG_VERSION}" >> $GITHUB_OUTPUT
echo "Publishing hankweave@${PKG_VERSION}"
- name: Verify tag matches version
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
PKG_VERSION="${{ steps.pkg-info.outputs.version }}"
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "Error: Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
exit 1
fi
echo "✓ Tag version matches package.json version"
- name: Run type check
run: bun run tc
- name: Run linting
run: bun run lint
- name: Verify package.json is configured for public release
run: |
PKG_NAME=$(node -p 'require("./package.json").name')
if [ "$PKG_NAME" != "hankweave" ]; then
echo "Error: package.json name is '$PKG_NAME', expected 'hankweave'"
echo "The sync workflow should have transformed package.json"
exit 1
fi
echo "✓ package.json configured correctly:"
echo " name: $PKG_NAME"
- name: Build
run: bun run build
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
build-executables:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- target: linux-x64
os: ubuntu-latest
can_test: true
- target: linux-arm64
os: ubuntu-latest
can_test: false
cross_codex_tag: "0.104.0-linux-arm64"
- target: darwin-x64
os: macos-latest
can_test: false
cross_codex_tag: "0.104.0-darwin-x64"
- target: darwin-arm64
os: macos-latest
can_test: true
- target: windows-x64
os: windows-latest
can_test: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install cross-platform codex binary
if: matrix.cross_codex_tag
shell: bash
run: |
# For cross-compilation: bun install only fetches the host platform's
# codex binary. Manually fetch the target platform's package and place
# it where the build script expects (node_modules/@openai/codex-<target>).
TARGET_DIR="node_modules/@openai/codex-${{ matrix.target }}"
mkdir -p "$TARGET_DIR"
npm pack "@openai/codex@${{ matrix.cross_codex_tag }}" --pack-destination /tmp
tar xzf /tmp/openai-codex-${{ matrix.cross_codex_tag }}.tgz -C "$TARGET_DIR" --strip-components=1
echo "✓ Installed cross-platform codex binary at $TARGET_DIR"
ls -la "$TARGET_DIR/vendor/" 2>/dev/null || echo " (no vendor dir — check package structure)"
- name: Build executable
run: bun scripts/build-executable.ts ${{ matrix.target }}
- name: Smoke test - Run --help
if: matrix.can_test
shell: bash
run: |
if [[ "${{ matrix.target }}" == "windows-x64" ]]; then
releases/hankweave.exe --help
else
./releases/hankweave --help
fi
- name: Upload executable artifact
uses: actions/upload-artifact@v4
with:
name: hankweave-${{ matrix.target }}
path: releases/hankweave${{ matrix.target == 'windows-x64' && '.exe' || '' }}
if-no-files-found: error
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [build-executables] # Only depends on binaries - release even if npm fails
if: always() && needs.build-executables.result == 'success'
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from tag
id: version
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release-assets
# Rename artifacts to include target in filename
mv artifacts/hankweave-linux-x64/hankweave release-assets/hankweave-linux-x64
mv artifacts/hankweave-linux-arm64/hankweave release-assets/hankweave-linux-arm64
mv artifacts/hankweave-darwin-x64/hankweave release-assets/hankweave-darwin-x64
mv artifacts/hankweave-darwin-arm64/hankweave release-assets/hankweave-darwin-arm64
mv artifacts/hankweave-windows-x64/hankweave.exe release-assets/hankweave-windows-x64.exe
# Make them executable
chmod +x release-assets/hankweave-*
# List files
ls -lh release-assets/
- name: Extract changelog for this version
id: changelog
run: |
VERSION="${{ steps.version.outputs.version }}"
# Check if RELEASE_NOTES.md exists (created by sync workflow)
if [ -f RELEASE_NOTES.md ]; then
echo "Using RELEASE_NOTES.md from sync workflow"
CHANGELOG_CONTENT=$(cat RELEASE_NOTES.md)
elif [ -f CHANGELOG.md ]; then
# Extract the section for this version from CHANGELOG.md
CHANGELOG_CONTENT=$(awk "/^## \[${VERSION}\]/,/^## \[/{if(/^## \[${VERSION}\]/) f=1; else if(/^## \[/) f=0; if(f && !/^## \[${VERSION}\]/) print}" CHANGELOG.md)
fi
if [ -z "$CHANGELOG_CONTENT" ]; then
echo "No changelog entry found for version ${VERSION}, using default notes"
CHANGELOG_CONTENT="See commits for details."
fi
# Save to file for release
cat > release-notes.md << 'NOTES_EOF'
## Installation
**Via npm:**
```bash
npm install -g hankweave
# or
npx hankweave --init
```
**Via Standalone Executable:**
Download the binary for your platform below, make it executable, and run it.
## What's Changed
NOTES_EOF
echo "$CHANGELOG_CONTENT" >> release-notes.md
cat >> release-notes.md << 'NOTES_EOF'
## Platform-Specific Instructions
### macOS
- **Apple Silicon (M1/M2/M3)**: `hankweave-darwin-arm64`
- **Intel**: `hankweave-darwin-x64`
After downloading:
```bash
xattr -d com.apple.quarantine hankweave-darwin-arm64
chmod +x hankweave-darwin-arm64
./hankweave-darwin-arm64 --help
```
### Linux
- **x64**: `hankweave-linux-x64`
- **ARM64**: `hankweave-linux-arm64`
```bash
chmod +x hankweave-linux-x64
./hankweave-linux-x64 --help
```
### Windows
- **x64**: `hankweave-windows-x64.exe`
```powershell
.\hankweave-windows-x64.exe --help
```
NOTES_EOF
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: Hankweave v${{ steps.version.outputs.version }}
body_path: release-notes.md
draft: false
prerelease: false
files: |
release-assets/hankweave-linux-x64
release-assets/hankweave-linux-arm64
release-assets/hankweave-darwin-x64
release-assets/hankweave-darwin-arm64
release-assets/hankweave-windows-x64.exe