Skip to content

ci: separate development and production registries (#63) #72

ci: separate development and production registries (#63)

ci: separate development and production registries (#63) #72

Workflow file for this run

name: Validate
on:
pull_request:
push:
branches:
- master
- development
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.8
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Run Tests
run: bun run test
- name: Type Check
run: bun run typecheck
- name: Validate Shader Manifests
run: bun run validate:shaders
- name: Build Registry
run: bun run build:registry
- name: Upload Registry Artifact
uses: actions/upload-artifact@v4
with:
name: registry
path: dist/registry/
deploy-registry:
needs: check
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/development')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.8
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Build Registry
run: bun run build:registry
- name: Deploy Registry (production)
if: github.ref == 'refs/heads/master'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy dist/registry --project-name=shaderbase-registry --branch=master
- name: Deploy Registry (development)
if: github.ref == 'refs/heads/development'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy dist/registry --project-name=shaderbase-registry --branch=development
# Web app deployment is pending — SolidJS + TanStack Start + Cloudflare Workers
# has a known bundling issue (ssrStyleProperty not exported in worker mode).
# Tracking: https://github.com/TanStack/router/issues/5291
# Options: Railway (Node.js), or wait for Cloudflare Vite plugin SolidJS support.
# deploy-web:
# needs: [check, deploy-registry]
# if: github.ref == 'refs/heads/master' && github.event_name == 'push'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: oven-sh/setup-bun@v2
# with:
# bun-version: 1.3.8
# - run: bun install --frozen-lockfile
# - run: cd apps/web && bun install --frozen-lockfile && bun run build
# # Deploy to Railway or Fly.io when ready
deploy-mcp:
needs: check
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/development')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.8
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Deploy MCP Worker (production)
if: github.ref == 'refs/heads/master'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: packages/mcp
command: deploy
- name: Deploy MCP Worker (development)
if: github.ref == 'refs/heads/development'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: packages/mcp
command: deploy --env development
publish-cli:
needs: check
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
environment:
name: npm
url: https://www.npmjs.com/package/@shaderbase/cli
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.8
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Upgrade npm (trusted publishing requires >= 11.5.1)
run: npm install -g npm@latest
- name: Build CLI
run: cd packages/cli && bun run build
- name: Publish to npm (if version changed)
run: |
cd packages/cli
CURRENT=$(npm view @shaderbase/cli version 2>/dev/null || echo "0.0.0")
LOCAL=$(node -p "require('./package.json').version")
if [ "$CURRENT" != "$LOCAL" ]; then
npm publish --access public --provenance
else
echo "Version $LOCAL already published, skipping."
fi