CI Workflow (.github/workflows/ci.yml): - Tests on Node.js 18, 20, 22 - Runs typecheck, tests, and build on every push/PR Release Workflow (.github/workflows/release.yml): - Triggered on version tags (v*) or manual dispatch - Builds TypeScript and web frontend - Creates distributable tarball and zip - Publishes GitHub release with binaries - Optional npm publishing (requires NPM_TOKEN secret) Closes nd-27yb 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
128 lines
3.2 KiB
YAML
128 lines
3.2 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version to release (e.g., 0.1.0)'
|
|
required: false
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run tests
|
|
run: npm test
|
|
|
|
- name: Build TypeScript
|
|
run: npm run build
|
|
|
|
- name: Build web frontend
|
|
run: npm run build:web
|
|
|
|
- name: Create distribution package
|
|
run: |
|
|
mkdir -p release
|
|
cp -r dist release/
|
|
cp -r node_modules release/
|
|
cp package.json release/
|
|
cp README.md release/
|
|
# Create wrapper script
|
|
cat > release/fabric << 'SCRIPT'
|
|
#!/usr/bin/env node
|
|
require('./dist/cli.js');
|
|
SCRIPT
|
|
chmod +x release/fabric
|
|
|
|
- name: Create archives
|
|
run: |
|
|
cd release
|
|
tar -czvf ../fabric-linux-x64.tar.gz .
|
|
zip -r ../fabric-linux-x64.zip .
|
|
|
|
- name: Get version
|
|
id: version
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
|
|
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ steps.version.outputs.VERSION }}
|
|
name: FABRIC v${{ steps.version.outputs.VERSION }}
|
|
body: |
|
|
## FABRIC v${{ steps.version.outputs.VERSION }}
|
|
|
|
Flow Analysis & Bead Reporting Interface Console
|
|
|
|
### Installation
|
|
|
|
```bash
|
|
# Download and extract
|
|
curl -L https://github.com/jedarden/FABRIC/releases/download/v${{ steps.version.outputs.VERSION }}/fabric-linux-x64.tar.gz | tar xz
|
|
|
|
# Run
|
|
./fabric tui # Terminal UI
|
|
./fabric web # Web dashboard
|
|
```
|
|
|
|
### Requirements
|
|
- Node.js >= 18.0.0
|
|
|
|
files: |
|
|
fabric-linux-x64.tar.gz
|
|
fabric-linux-x64.zip
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Optional: Publish to npm
|
|
publish-npm:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Publish to npm
|
|
run: npm publish --access public
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|