Skip to content

Commit 958be08

Browse files
Jonathan D.A. Jewellclaude
andcommitted
ci: Add release workflow and publishing guide
- GitHub Actions workflow for multi-platform builds - Automatic publishing to crates.io and npm on tag - PUBLISHING.md with step-by-step instructions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c44e4d2 commit 958be08

2 files changed

Lines changed: 342 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., 1.0.0)'
11+
required: true
12+
13+
env:
14+
CARGO_TERM_COLOR: always
15+
16+
jobs:
17+
build:
18+
name: Build ${{ matrix.target }}
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
# Linux x86_64
25+
- target: x86_64-unknown-linux-gnu
26+
os: ubuntu-latest
27+
artifact: bunsenite
28+
archive: tar.gz
29+
# Linux aarch64
30+
- target: aarch64-unknown-linux-gnu
31+
os: ubuntu-latest
32+
artifact: bunsenite
33+
archive: tar.gz
34+
cross: true
35+
# macOS x86_64
36+
- target: x86_64-apple-darwin
37+
os: macos-latest
38+
artifact: bunsenite
39+
archive: tar.gz
40+
# macOS aarch64 (Apple Silicon)
41+
- target: aarch64-apple-darwin
42+
os: macos-latest
43+
artifact: bunsenite
44+
archive: tar.gz
45+
# Windows x86_64
46+
- target: x86_64-pc-windows-msvc
47+
os: windows-latest
48+
artifact: bunsenite.exe
49+
archive: zip
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Install Rust
55+
uses: dtolnay/rust-action@stable
56+
with:
57+
targets: ${{ matrix.target }}
58+
59+
- name: Install cross (for cross-compilation)
60+
if: matrix.cross
61+
run: cargo install cross --git https://github.com/cross-rs/cross
62+
63+
- name: Install Zig
64+
uses: goto-bus-stop/setup-zig@v2
65+
with:
66+
version: 0.11.0
67+
68+
- name: Build Rust (native)
69+
if: ${{ !matrix.cross }}
70+
run: cargo build --release --features full --target ${{ matrix.target }}
71+
72+
- name: Build Rust (cross)
73+
if: matrix.cross
74+
run: cross build --release --features full --target ${{ matrix.target }}
75+
76+
- name: Build Zig FFI (Unix)
77+
if: runner.os != 'Windows'
78+
run: cd zig && zig build -Doptimize=ReleaseFast
79+
80+
- name: Build Zig FFI (Windows)
81+
if: runner.os == 'Windows'
82+
run: cd zig && zig build -Doptimize=ReleaseFast
83+
84+
- name: Prepare archive (Unix)
85+
if: runner.os != 'Windows'
86+
run: |
87+
mkdir -p dist
88+
cp target/${{ matrix.target }}/release/${{ matrix.artifact }} dist/
89+
cp zig/zig-out/lib/libbunsenite.* dist/ || true
90+
cp README.md LICENSE-MIT dist/
91+
cd dist && tar -czvf ../bunsenite-${{ github.ref_name }}-${{ matrix.target }}.${{ matrix.archive }} *
92+
93+
- name: Prepare archive (Windows)
94+
if: runner.os == 'Windows'
95+
shell: pwsh
96+
run: |
97+
New-Item -ItemType Directory -Force -Path dist
98+
Copy-Item target/${{ matrix.target }}/release/${{ matrix.artifact }} dist/
99+
Copy-Item zig/zig-out/lib/bunsenite.* dist/ -ErrorAction SilentlyContinue
100+
Copy-Item README.md,LICENSE-MIT dist/
101+
Compress-Archive -Path dist/* -DestinationPath bunsenite-${{ github.ref_name }}-${{ matrix.target }}.${{ matrix.archive }}
102+
103+
- name: Upload artifact
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: bunsenite-${{ matrix.target }}
107+
path: bunsenite-*.${{ matrix.archive }}
108+
109+
release:
110+
name: Create Release
111+
needs: build
112+
runs-on: ubuntu-latest
113+
permissions:
114+
contents: write
115+
116+
steps:
117+
- uses: actions/checkout@v4
118+
119+
- name: Download all artifacts
120+
uses: actions/download-artifact@v4
121+
with:
122+
path: artifacts
123+
124+
- name: List artifacts
125+
run: find artifacts -type f
126+
127+
- name: Create checksums
128+
run: |
129+
cd artifacts
130+
find . -name "bunsenite-*" -type f -exec sha256sum {} \; > ../SHA256SUMS.txt
131+
cat ../SHA256SUMS.txt
132+
133+
- name: Create GitHub Release
134+
uses: softprops/action-gh-release@v1
135+
with:
136+
files: |
137+
artifacts/**/*
138+
SHA256SUMS.txt
139+
draft: false
140+
prerelease: false
141+
generate_release_notes: true
142+
body: |
143+
## Bunsenite ${{ github.ref_name }}
144+
145+
Nickel configuration file parser with multi-language FFI bindings.
146+
147+
### Installation
148+
149+
**Cargo (Rust):**
150+
```bash
151+
cargo install bunsenite
152+
```
153+
154+
**Homebrew (macOS):**
155+
```bash
156+
brew install bunsenite
157+
```
158+
159+
**Download binaries:**
160+
See assets below for pre-built binaries.
161+
162+
### Features
163+
- Parse and evaluate Nickel configuration files
164+
- Watch mode for live reloading
165+
- Interactive REPL
166+
- JSON Schema validation
167+
- FFI bindings for Deno, ReScript, Node.js
168+
169+
RSR Compliance: Bronze Tier | TPCF Perimeter: 3
170+
171+
publish-crates:
172+
name: Publish to crates.io
173+
needs: release
174+
runs-on: ubuntu-latest
175+
steps:
176+
- uses: actions/checkout@v4
177+
178+
- name: Install Rust
179+
uses: dtolnay/rust-action@stable
180+
181+
- name: Publish to crates.io
182+
env:
183+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
184+
run: cargo publish --no-verify
185+
186+
publish-npm:
187+
name: Publish to npm
188+
needs: release
189+
runs-on: ubuntu-latest
190+
steps:
191+
- uses: actions/checkout@v4
192+
193+
- name: Setup Node.js
194+
uses: actions/setup-node@v4
195+
with:
196+
node-version: '20'
197+
registry-url: 'https://registry.npmjs.org'
198+
199+
- name: Publish to npm
200+
working-directory: bindings/rescript
201+
env:
202+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
203+
run: npm publish --access public

PUBLISHING.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Publishing Bunsenite
2+
3+
This guide walks through publishing bunsenite to all package managers.
4+
5+
## Prerequisites
6+
7+
You'll need accounts and tokens for:
8+
- **crates.io** - Rust package registry
9+
- **npm** - Node.js package registry
10+
- **GitHub** - For releases and Homebrew tap
11+
12+
## Step 1: Configure GitHub Secrets
13+
14+
Go to your repo → Settings → Secrets and variables → Actions → New repository secret
15+
16+
| Secret Name | How to Get It |
17+
|-------------|---------------|
18+
| `CARGO_REGISTRY_TOKEN` | https://crates.io/settings/tokens → New Token |
19+
| `NPM_TOKEN` | https://www.npmjs.com/settings/tokens → Generate New Token (Automation) |
20+
21+
## Step 2: Create and Push a Tag
22+
23+
```bash
24+
# Create the v1.0.0 tag
25+
git tag -a v1.0.0 -m "Release v1.0.0"
26+
27+
# Push the tag (this triggers the release workflow)
28+
git push origin v1.0.0
29+
```
30+
31+
This automatically:
32+
- Builds binaries for Linux, macOS, Windows
33+
- Creates a GitHub Release with all artifacts
34+
- Publishes to crates.io
35+
- Publishes to npm
36+
37+
## Step 3: Homebrew (Manual)
38+
39+
Option A: **Create your own tap** (recommended for new packages):
40+
41+
```bash
42+
# Create a new repo: hyperpolymath/homebrew-tap
43+
# Then add the formula
44+
45+
mkdir -p homebrew-tap/Formula
46+
cp packaging/homebrew/bunsenite.rb homebrew-tap/Formula/
47+
48+
# Update the sha256 from the GitHub release
49+
# Then users install with:
50+
# brew tap hyperpolymath/tap
51+
# brew install bunsenite
52+
```
53+
54+
Option B: **Submit to homebrew-core** (after package is established):
55+
56+
```bash
57+
# Fork homebrew/homebrew-core
58+
# Add Formula/bunsenite.rb
59+
# Submit PR
60+
```
61+
62+
## Step 4: Arch Linux (AUR)
63+
64+
```bash
65+
# Clone your AUR package (first time: create it)
66+
git clone ssh://aur@aur.archlinux.org/bunsenite.git aur-bunsenite
67+
cd aur-bunsenite
68+
69+
# Copy PKGBUILD
70+
cp ../packaging/arch/PKGBUILD .
71+
72+
# Update checksums
73+
updpkgsums
74+
75+
# Generate .SRCINFO
76+
makepkg --printsrcinfo > .SRCINFO
77+
78+
# Commit and push
79+
git add PKGBUILD .SRCINFO
80+
git commit -m "Update to v1.0.0"
81+
git push
82+
```
83+
84+
## Step 5: Other Package Managers
85+
86+
### Flatpak (Flathub)
87+
1. Fork https://github.com/flathub/flathub
88+
2. Create `com.campaignforcoolercoding.bunsenite/` directory
89+
3. Copy `packaging/flatpak/com.campaignforcoolercoding.bunsenite.yml`
90+
4. Submit PR
91+
92+
### Scoop (Windows)
93+
1. Fork https://github.com/ScoopInstaller/Main (or create own bucket)
94+
2. Add `bucket/bunsenite.json`
95+
3. Submit PR
96+
97+
### Chocolatey (Windows)
98+
```bash
99+
cd packaging/chocolatey
100+
# Update bunsenite.nuspec with correct URLs
101+
choco pack
102+
choco push bunsenite.1.0.0.nupkg --source https://push.chocolatey.org/
103+
```
104+
105+
### winget (Windows)
106+
1. Fork https://github.com/microsoft/winget-pkgs
107+
2. Create `manifests/c/CampaignForCoolerCoding/Bunsenite/1.0.0/`
108+
3. Copy and split manifest files
109+
4. Submit PR
110+
111+
## Quick Start Commands
112+
113+
```bash
114+
# Step 1: Add secrets to GitHub (do this in browser)
115+
116+
# Step 2: Tag and release
117+
git tag -a v1.0.0 -m "Release v1.0.0"
118+
git push origin v1.0.0
119+
120+
# Step 3: Wait for CI, then verify
121+
# - Check GitHub Actions for build status
122+
# - Check https://crates.io/crates/bunsenite
123+
# - Check https://www.npmjs.com/package/bunsenite
124+
```
125+
126+
## Verification
127+
128+
After publishing, verify each registry:
129+
130+
```bash
131+
# Cargo
132+
cargo install bunsenite
133+
134+
# npm
135+
npm info bunsenite
136+
137+
# GitHub Release
138+
gh release view v1.0.0
139+
```

0 commit comments

Comments
 (0)