Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.

fix: CLAUDE.md/AGENTS.md paths, config loading, drop ci.yml #3

fix: CLAUDE.md/AGENTS.md paths, config loading, drop ci.yml

fix: CLAUDE.md/AGENTS.md paths, config loading, drop ci.yml #3

Workflow file for this run

name: npm Release
# Publishes @unknownstudio/thoth + 4 platform subpackages to npm on tag push.
# Prerelease tags (e.g. v0.0.1-alpha) publish under npm dist-tag `alpha`;
# stable tags publish under `latest`.
#
# Runs in parallel with release.yml — this workflow handles npm only,
# release.yml handles the GitHub Release tarballs consumed by Homebrew.
on:
push:
tags: ["v*.*.*"]
workflow_dispatch:
inputs:
version:
description: "Version to publish (without leading v, e.g. 0.0.1-alpha)"
required: true
permissions:
contents: read
jobs:
build:
name: build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
use_cross: true
platform: linux-x64
npm_os: linux
npm_cpu: x64
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
use_cross: true
platform: linux-arm64
npm_os: linux
npm_cpu: arm64
- target: aarch64-apple-darwin
os: macos-14
use_cross: false
platform: darwin-arm64
npm_os: darwin
npm_cpu: arm64
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
run: cargo install cross --locked
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build release binaries
shell: bash
run: |
set -euo pipefail
if [ "${{ matrix.use_cross }}" = "true" ]; then
cross build --release --locked --target ${{ matrix.target }} \
-p thoth-cli -p thoth-mcp
else
cargo build --release --locked --target ${{ matrix.target }} \
-p thoth-cli -p thoth-mcp
fi
- name: Resolve version
id: ver
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
V="${{ github.event.inputs.version }}"
else
V="${GITHUB_REF_NAME#v}"
fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "→ version=$V" >&2
- name: Assemble platform subpackage
shell: bash
run: |
set -euo pipefail
VERSION="${{ steps.ver.outputs.version }}"
PKG_DIR="staging/thoth-${{ matrix.platform }}"
mkdir -p "$PKG_DIR/bin"
BIN_SRC="target/${{ matrix.target }}/release"
cp "$BIN_SRC/thoth" "$BIN_SRC/thoth-mcp" "$BIN_SRC/thoth-gate" "$PKG_DIR/bin/"
chmod +x "$PKG_DIR/bin/"*
sed \
-e "s|{PLATFORM}|${{ matrix.platform }}|g" \
-e "s|{TRIPLE}|${{ matrix.target }}|g" \
-e "s|{OS}|${{ matrix.npm_os }}|g" \
-e "s|{CPU}|${{ matrix.npm_cpu }}|g" \
packaging/npm/platform-stubs/template/package.json > "$PKG_DIR/package.json"
jq --arg v "$VERSION" '.version = $v' \
"$PKG_DIR/package.json" > "$PKG_DIR/package.json.tmp"
mv "$PKG_DIR/package.json.tmp" "$PKG_DIR/package.json"
cat "$PKG_DIR/package.json"
- uses: actions/upload-artifact@v4
with:
name: thoth-${{ matrix.platform }}
path: staging/thoth-${{ matrix.platform }}
if-no-files-found: error
retention-days: 1
publish:
name: publish to npm
needs: build
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- name: Resolve version + npm tag
id: ver
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
V="${{ github.event.inputs.version }}"
else
V="${GITHUB_REF_NAME#v}"
fi
if [[ "$V" == *-* ]]; then
TAG="alpha"
else
TAG="latest"
fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "→ version=$V tag=$TAG" >&2
- name: Download platform artifacts
uses: actions/download-artifact@v4
with:
pattern: thoth-*
path: staging/
merge-multiple: false
- name: Restore executable bit
shell: bash
run: |
set -euo pipefail
for d in staging/thoth-*/bin; do
chmod +x "$d"/*
done
ls -la staging/thoth-*/bin/
- name: Publish platform subpackages
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
set -euo pipefail
for d in staging/thoth-*/; do
echo "→ publishing $(jq -r .name "$d/package.json")@${{ steps.ver.outputs.version }}"
(cd "$d" && npm publish --access public --tag "${{ steps.ver.outputs.tag }}")
done
- name: Assemble + publish wrapper
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
set -euo pipefail
VERSION="${{ steps.ver.outputs.version }}"
WRAPPER="staging/wrapper"
cp -R packaging/npm/thoth "$WRAPPER"
jq --arg v "$VERSION" '
.version = $v
| .optionalDependencies |= (to_entries | map(.value = $v) | from_entries)
' "$WRAPPER/package.json" > "$WRAPPER/package.json.tmp"
mv "$WRAPPER/package.json.tmp" "$WRAPPER/package.json"
cat "$WRAPPER/package.json"
(cd "$WRAPPER" && npm publish --access public --tag "${{ steps.ver.outputs.tag }}")