Skip to content

Self-improving AI Employees for everyone

Fix npm publish: use OIDC trusted publishing, build all services, reduce package size

trohitg2b4eb377d730
diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml
index bef5814b..3d64393e 100644
--- a/.github/workflows/npm-publish.yml
+++ b/.github/workflows/npm-publish.yml
@@ -1,27 +1,23 @@
-# Publish to npm registry when a version tag is pushed
+# Publish to npm registry using OIDC Trusted Publishing
+# No npm token required - uses GitHub OIDC authentication
#
-# NOTE: npm now requires Granular Access Tokens (classic tokens revoked)
-# - Granular tokens require 2FA and expire after 90 days max
-# - Create token at: https://www.npmjs.com/settings/YOUR_USERNAME/tokens
-# - Select "Granular Access Token" with publish permissions for this package
-# - Add as NPM_TOKEN secret in GitHub repo settings
-# - Remember to rotate before expiry (max 90 days)
+# Setup: Go to npmjs.com → Package Settings → Trusted Publishers
+# Add: Owner: trohitg, Repo: MachinaOS, Workflow: npm-publish.yml
+#
+# Reference: https://docs.npmjs.com/trusted-publishers/
name: Publish to npm
on:
- # Trigger on version tags (e.g., v0.0.1, v1.2.3)
push:
tags:
- 'v*.*.*'
- # Also trigger on published releases
release:
types: [published]
- # Allow manual trigger
workflow_dispatch:
jobs:
- publish-npm:
+ publish:
runs-on: ubuntu-latest
permissions:
contents: read
@@ -36,16 +32,21 @@ jobs:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- - name: Install root dependencies
- run: npm ci
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.12'
+
+ - name: Setup Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: '1.21'
- - name: Install client dependencies
- run: cd client && npm ci
+ - name: Install uv
+ run: curl -LsSf https://astral.sh/uv/install.sh | sh && echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- - name: Build client
- run: cd client && npm run build
+ - name: Build all services
+ run: npm run build
- name: Publish to npm
- run: npm publish --access public
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+ run: npm publish --access public --provenance
diff --git a/.npmignore b/.npmignore
index 1898b3d4..573c88c8 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1,3 +1,7 @@
+# ===========================================
+# npmignore - Files to exclude from npm package
+# ===========================================
+
# Git
.git/
.gitignore
@@ -7,30 +11,40 @@
.env
.env.*
!.env.template
+
+# Database files
*.db
*.sqlite
*.db-journal
*.db-shm
*.db-wal
-data/
-# Python virtual environment
-.venv/
-venv/
+# Python cache and virtual env (all locations)
__pycache__/
+**/__pycache__/
*.pyc
+**/*.pyc
*.pyo
+**/*.pyo
+.venv/
+venv/
+**/.venv/
+**/venv/
*.egg-info/
-# Node modules (installed on user's machine)
+# Server data directories
+server/data/
+
+# Node modules (all locations)
node_modules/
**/node_modules/
-client/node_modules/
-server/whatsapp-rpc/node_modules/
# Vite cache
+.vite/
**/.vite/
-client/.vite/
+
+# Client build output (users build locally)
+client/dist/
# IDE & editors
.vscode/
@@ -45,12 +59,9 @@ client/.vite/
.DS_Store
Thumbs.db
-# Build artifacts & logs
+# Logs
*.log
-*.tmp
-*.temp
logs/
-build/
# Test files
__tests__/
@@ -68,22 +79,23 @@ CLAUDE.md
# Duplicate folder
MachinaOS/
-# WhatsApp session data
+# WhatsApp session/temp data
server/whatsapp-rpc/.wwebjs_*/
server/whatsapp-rpc/session/
server/whatsapp-rpc/qr_*.png
-server/whatsapp-rpc/*.db
server/whatsapp-rpc/data/
server/whatsapp-rpc/bin/
-# Server data directories
-server/data/
-server/*.db
-
-# Credentials (should never be committed anyway)
-**/credentials.json
-**/secrets.json
-**/apikeys.json
-**/*.pem
-**/*.key
-**/*.crt
+# Temporary files
+*.tmp
+*.temp
+*.bak
+*.backup
+*~
+
+# Package lock files
+package-lock.json
+**/package-lock.json
+
+# Build/deploy scripts not needed for users
+deploy.sh
diff --git a/package.json b/package.json
index 6c786c0f..1838d7cc 100644
--- a/package.json
+++ b/package.json
@@ -29,15 +29,6 @@
"bin": {
"machinaos": "./bin/cli.js"
},
- "files": [
- "bin/",
- "client/",
- "server/",
- "scripts/",
- "docker-compose.yml",
- "docker-compose.prod.yml",
- ".env.template"
- ],
"engines": {
"node": ">=18.0.0"
},