CI/CD Integration

Automate deployments in your CI/CD pipeline using the NetLaunch CLI.

Setup

  1. Generate an API key from the dashboard (Settings → Generate Key)
  2. Add it as a secret in your CI system
  3. Add the deploy step to your pipeline

GitHub Actions

name: Deploy

on:
  push:
    branches: [main]

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

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

      - name: Build
        run: npm ci && npm run build

      - name: Zip build output
        run: cd dist && zip -r ../site.zip .

      - name: Deploy to NetLaunch
        env:
          NETLAUNCH_KEY: ${{ secrets.NETLAUNCH_KEY }}
        run: npx netlaunch deploy -s my-app -f ./site.zip

GitLab CI

deploy:
  stage: deploy
  image: node:20
  script:
    - npm ci && npm run build
    - cd dist && zip -r ../site.zip . && cd ..
    - npx netlaunch deploy -s my-app -f ./site.zip
  variables:
    NETLAUNCH_KEY: $NETLAUNCH_KEY
  only:
    - main

Bitbucket Pipelines

pipelines:
  branches:
    main:
      - step:
          name: Deploy
          image: node:20
          script:
            - npm ci && npm run build
            - cd dist && zip -r ../site.zip . && cd ..
            - npx netlaunch deploy -s my-app -f ./site.zip

Generic Script

Works in any CI environment:

#!/bin/bash
set -e

# Build your project
npm ci && npm run build

# Create ZIP from build output
cd dist && zip -r ../site.zip . && cd ..

# Deploy (requires NETLAUNCH_KEY env var)
npx netlaunch deploy -s my-app -f ./site.zip

Environment Variables

Variable Description
NETLAUNCH_KEY Your API key (fk_...). Required for CI/CD.

Tips

# Staging (on PR merge)
npx netlaunch deploy -s my-app-staging -f ./site.zip

# Production (on release tag)
npx netlaunch deploy -s my-app -f ./site.zip