CI/CD Integration

Local Bridge supports headless, non-interactive environments. Use the --yes flag and LOCALBRIDGE_LICENSE_KEY environment variable to run it safely inside automated pipelines.

Non-Interactive Mode

In CI environments, the CLI cannot prompt for input. Use these options:

  • --yes or -y - Skip all confirmation prompts
  • LOCALBRIDGE_LICENSE_KEY - Inject your license key via environment variable
  • --bg - Run in the background so the pipeline can continue

GitHub Actions

name: Deploy Preview
on: [pull_request]

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

      - name: Download Local Bridge
        run: |
          curl -L -o localbridge \
            https://api-localbridge.theneritic.com/download/linux/amd64
          chmod +x localbridge

      - name: Activate License
        env:
          LOCALBRIDGE_LICENSE_KEY: ${{ secrets.LB_LICENSE_KEY }}
        run: ./localbridge activate --yes

      - name: Start Background Share
        run: |
          ./localbridge --bg --yes --name preview ./dist
          # Exit code 6 = already running (safe to ignore)
          if [ $? -eq 6 ]; then
            echo "Already running, continuing..."
          fi

      - name: Show Share URL
        run: ./localbridge list

GitLab CI

deploy_preview:
  stage: deploy
  script:
    - curl -L -o localbridge https://api-localbridge.theneritic.com/download/linux/amd64
    - chmod +x localbridge
    - LOCALBRIDGE_LICENSE_KEY=$LB_KEY ./localbridge activate --yes
    - ./localbridge --bg --yes . || [ $? -eq 6 ]
    - ./localbridge list

Jenkins

sh '''
  ./localbridge --bg --yes . || EXIT_CODE=$?
  if [ $EXIT_CODE -eq 6 ]; then
    echo "Already running"
    exit 0
  fi
  exit $EXIT_CODE
'''

PowerShell (Windows CI)

localbridge --bg --yes .
if ($LASTEXITCODE -eq 1) {
    Write-Host "Port in use, trying fallback..."
    localbridge --bg --port 9000 .
} elseif ($LASTEXITCODE -eq 6) {
    Write-Host "Already running, skipping..."
} else {
    Write-Host "Failed with code $LASTEXITCODE"
    exit 1
}

Exit Codes for Scripts

Key codes for CI: 0 = success, 1 = port in use, 6 = already running (safe to ignore), 7 = network error. See the full Exit Codes Reference for all codes.