CI/CD Integration

Use the CLI in CI/CD pipelines to deploy automatically on push. The recommended approach is to set ZYBERSPACE_TOKEN as a secret environment variable.

GitHub Actions

Store your API token as a repository secret (ZYBERSPACE_TOKEN). Then add a deploy step to your workflow: npx @zxapi/cli deploy ./dist --site my-site --publish with env: ZYBERSPACE_TOKEN: ${{ secrets.ZYBERSPACE_TOKEN }}. The CLI will automatically resolve the token from the environment variable.

Generic CI

Set ZYBERSPACE_TOKEN in your CI environment variables, install the CLI (npm install -g @zxapi/cli), then run zyber deploy ./dist --site my-site --publish. No config file needed — the environment variable takes priority.

Best practices

Create a dedicated API key for CI with minimal scopes: sites:read, sites:write (if auto-creating), deployments:write. Optionally add an IP allowlist if your CI provider supports static IPs. Set an expiry date on the key for rotation discipline.

Example response

name: Deploy to zyberspace
on:
push:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 10

- uses: actions/setup-node@v4
with:
node-version: 20

- run: npm run build

- run: npx zyber deploy ./dist --site my-site --publish
env:
ZYBERSPACE_TOKEN: ${{ secrets.ZYBERSPACE_TOKEN }}

Code examples

cURL
# Install in CI
npm install -g @zxapi/cli

# Deploy (token from environment variable)
zyber deploy ./dist --site my-site --publish
# ZYBERSPACE_TOKEN is read automatically from env
JavaScript
// GitHub Actions workflow example:
// .github/workflows/deploy.yml
//
// name: Deploy to zyberspace
// on:
// push:
// branches: [main]
// jobs:
// deploy:
// runs-on: ubuntu-latest
// steps:
// - uses: actions/checkout@v4
// - run: npm run build
// - run: npx @zxapi/cli deploy ./dist --site my-site --publish
// env:
// ZYBERSPACE_TOKEN: ${{ secrets.ZYBERSPACE_TOKEN }}

Base URL: https://www.zyberspace.com

Get your API key →