release - saltict/Demo-Docs GitHub Wiki

Release Process

This document describes the complete release process for the SubWallet Services SDK, including automated pipelines, quality gates, and deployment procedures.

Quick Navigation

Overview

The SubWallet Services SDK follows a structured release process that ensures quality, consistency, and reliability across all deployments. The process integrates automated testing, building, and publishing with manual approval gates for critical releases.

Release Workflow

Release Types

Type Trigger Approval Automation Level Target Audience
Alpha Feature branch merge Auto Full Internal testing
Beta Development milestone Manual Full Integration testing
RC Pre-release validation Manual Full UAT/Staging
Stable Production readiness Manual Full Production
Hotfix Critical bug fix Manual Partial Production (urgent)

Workflow Diagram

%%{init: {'theme':'dark'}}%%
graph TB
    Start[Start Release] --> Type{Release Type}
    
    Type -->|Alpha| AutoAlpha[Auto Alpha Release]
    Type -->|Beta| ManualBeta[Manual Beta Release]
    Type -->|RC/Stable| ManualStable[Manual Stable Release]
    Type -->|Hotfix| Hotfix[Hotfix Process]
    
    AutoAlpha --> Build[Build & Test]
    ManualBeta --> Approval1[Manual Approval]
    ManualStable --> Approval2[Manual Approval]
    Hotfix --> Emergency[Emergency Build]
    
    Approval1 --> Build
    Approval2 --> Build
    Emergency --> Build
    
    Build --> Test[Automated Testing]
    Test --> Quality[Quality Gates]
    Quality --> Package[Package Creation]
    Package --> Publish[Registry Publishing]
    Publish --> Deploy[Deployment]
    Deploy --> Notify[Notifications]
    Notify --> End[Release Complete]
    
    Quality -->|Fail| Build
    
    style Start fill:#2d3748,stroke:#4a5568,color:#fff
    style Type fill:#1a202c,stroke:#2d3748,color:#fff
    style AutoAlpha fill:#10b981,stroke:#059669,color:#fff
    style ManualBeta fill:#3b82f6,stroke:#2563eb,color:#fff
    style ManualStable fill:#8b5cf6,stroke:#7c3aed,color:#fff
    style Hotfix fill:#ef4444,stroke:#dc2626,color:#fff
    style Build fill:#2d3748,stroke:#4a5568,color:#fff
    style Test fill:#2d3748,stroke:#4a5568,color:#fff
    style Quality fill:#fbbf24,stroke:#f59e0b,color:#000
    style Package fill:#2d3748,stroke:#4a5568,color:#fff
    style Publish fill:#553c9a,stroke:#6b46c1,color:#fff
    style Deploy fill:#10b981,stroke:#059669,color:#fff
    style End fill:#065f46,stroke:#047857,color:#fff
Loading

Build Pipeline

Nx Build Configuration

The SDK uses Nx for build orchestration with the following configuration:

File: libs/subwallet-services-sdk/project.json

{
  "name": "subwallet-services-sdk",
  "sourceRoot": "libs/subwallet-services-sdk/src",
  "projectType": "library",
  "targets": {
    "build": {
      "executor": "@nx/vite:build",
      "options": {
        "outputPath": "dist/libs/subwallet-services-sdk"
      }
    }
  }
}

Build Steps

1. Environment Setup

# Set environment variables
export NX_NO_CLOUD=true
export KONI_REGISTRY=https://registry.konistudio.xyz
export NODE_ENV=production

2. Dependency Installation

# Install dependencies
yarn install --frozen-lockfile

# Verify dependency integrity
yarn audit --level moderate

3. Code Quality Checks

# ESLint validation
nx lint subwallet-services-sdk

# TypeScript compilation check
nx build subwallet-services-sdk --dry-run

# Format validation
nx format:check

4. Testing

# Unit tests
nx test subwallet-services-sdk

# Integration tests
nx e2e subwallet-services-sdk-e2e

# Coverage report
nx test subwallet-services-sdk --coverage

5. Build Compilation

# Build library
nx build subwallet-services-sdk

# Verify build outputs
ls -la dist/libs/subwallet-services-sdk/

Build Outputs

dist/libs/subwallet-services-sdk/
├── index.js                 # Main entry point
├── index.d.ts              # TypeScript declarations
├── package.json            # NPM package configuration
├── README.md               # Package documentation
├── lib/                    # Compiled library code
├── services/               # Service implementations
└── types/                  # Type definitions

Quality Gates

Code Quality Metrics

Metric Threshold Tool Action on Failure
Test Coverage ≥ 80% Jest Block release
ESLint Score 0 errors ESLint Block release
TypeScript 0 errors TSC Block release
Bundle Size < 500KB Bundler Warning
Security 0 high/critical Audit Block release

Automated Quality Checks

// File: scripts/quality-gates.ts
interface QualityGate {
  name: string;
  threshold: number;
  current: number;
  status: 'pass' | 'fail' | 'warning';
}

export async function runQualityGates(): Promise<QualityGate[]> {
  const gates: QualityGate[] = [
    await checkTestCoverage(),
    await checkLintErrors(),
    await checkTypeErrors(),
    await checkBundleSize(),
    await checkSecurityVulnerabilities()
  ];
  
  return gates;
}

async function checkTestCoverage(): Promise<QualityGate> {
  const coverage = await getCoverageReport();
  return {
    name: 'Test Coverage',
    threshold: 80,
    current: coverage.percentage,
    status: coverage.percentage >= 80 ? 'pass' : 'fail'
  };
}

Quality Gate Pipeline

%%{init: {'theme':'dark'}}%%
graph LR
    Code[Source Code] --> Lint[ESLint Check]
    Lint --> Type[TypeScript Check]
    Type --> Test[Unit Tests]
    Test --> Coverage[Coverage Check]
    Coverage --> Security[Security Audit]
    Security --> Bundle[Bundle Analysis]
    Bundle --> Pass{All Pass?}
    
    Pass -->|Yes| Release[Continue Release]
    Pass -->|No| Block[Block Release]
    
    style Code fill:#2d3748,stroke:#4a5568,color:#fff
    style Lint fill:#2d3748,stroke:#4a5568,color:#fff
    style Type fill:#2d3748,stroke:#4a5568,color:#fff
    style Test fill:#2d3748,stroke:#4a5568,color:#fff
    style Coverage fill:#2d3748,stroke:#4a5568,color:#fff
    style Security fill:#2d3748,stroke:#4a5568,color:#fff
    style Bundle fill:#2d3748,stroke:#4a5568,color:#fff
    style Pass fill:#fbbf24,stroke:#f59e0b,color:#000
    style Release fill:#10b981,stroke:#059669,color:#fff
    style Block fill:#ef4444,stroke:#dc2626,color:#fff
Loading

Package Publishing

Registry Configuration

The SDK supports multiple registry targets:

Public NPM Registry

# Configure for public NPM
npm config set registry https://registry.npmjs.org/
npm login

Private Koni Registry

# Configure for private registry
npm config set registry https://registry.konistudio.xyz
npm login --registry=https://registry.konistudio.xyz

Publishing Script

File: /scripts/publish-libs.sh

#!/bin/bash

export NX_NO_CLOUD=true
export KONI_REGISTRY=https://registry.konistudio.xyz

# Build all libraries
echo "Building libraries..."
yarn nx run cardano:build
yarn nx run subwallet-interfaces:build
yarn nx run subwallet-shared:build
yarn nx run swap-service:build
yarn nx run xcm:build
yarn nx run subwallet-services-sdk:build

# Publish to registry
echo "Publishing to registry: ${KONI_REGISTRY}"
(cd dist/libs/cardano && npm publish --registry=${KONI_REGISTRY})
(cd dist/libs/subwallet-interfaces && npm publish --registry=${KONI_REGISTRY})
(cd dist/libs/subwallet-shared && npm publish --registry=${KONI_REGISTRY})
(cd dist/libs/swap-service && npm publish --registry=${KONI_REGISTRY})
(cd dist/libs/xcm && npm publish --registry=${KONI_REGISTRY})
(cd dist/libs/subwallet-services-sdk && npm publish --registry=${KONI_REGISTRY})

echo "Publishing complete!"

Publication Verification

// File: scripts/verify-publication.ts
export async function verifyPublication(
  packageName: string, 
  version: string, 
  registry: string
): Promise<boolean> {
  try {
    const response = await fetch(`${registry}/${packageName}/${version}`);
    return response.ok;
  } catch (error) {
    console.error(`Failed to verify publication: ${error}`);
    return false;
  }
}

// Usage
await verifyPublication(
  '@subwallet-monorepos/subwallet-services-sdk',
  '0.1.3-beta.5',
  'https://registry.konistudio.xyz'
);

Deployment Automation

CI/CD Integration

GitHub Actions Workflow

# File: .github/workflows/release.yml
name: Release Pipeline

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'
          cache: 'yarn'
      
      - name: Install dependencies
        run: yarn install --frozen-lockfile
      
      - name: Run quality gates
        run: |
          yarn nx run-many --target=lint
          yarn nx run-many --target=test
          yarn nx run-many --target=build
      
      - name: Publish packages
        run: |
          npm config set //registry.konistudio.xyz/:_authToken ${{ secrets.NPM_TOKEN }}
          ./scripts/publish-libs.sh
        env:
          KONI_REGISTRY: https://registry.konistudio.xyz
      
      - name: Create release notes
        uses: actions/create-release@v1
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}

Rollback Strategy

Automated Rollback

// File: scripts/rollback.ts
export async function rollbackRelease(
  packageName: string,
  targetVersion: string,
  registry: string
): Promise<void> {
  console.log(`Rolling back ${packageName} to ${targetVersion}`);
  
  // Deprecate current version
  await deprecateVersion(packageName, 'latest', registry);
  
  // Promote target version to latest
  await promoteVersion(packageName, targetVersion, registry);
  
  // Update dependency references
  await updateDependencies(packageName, targetVersion);
  
  console.log('Rollback completed successfully');
}

Manual Rollback Process

  1. Identify Issue: Determine the scope and impact of the problem
  2. Select Target Version: Choose the last known good version
  3. Execute Rollback: Use automated rollback scripts
  4. Verify Rollback: Test the rolled-back version
  5. Communicate: Notify stakeholders of the rollback

Release Notifications

Automated Notifications

// File: scripts/notify-release.ts
export async function notifyRelease(
  version: string,
  releaseNotes: string
): Promise<void> {
  // Send to Slack
  await sendSlackNotification({
    channel: '#releases',
    message: `🚀 SubWallet Services SDK ${version} released!\n${releaseNotes}`
  });
  
  // Send email to stakeholders
  await sendEmailNotification({
    to: ['[email protected]', '[email protected]'],
    subject: `SubWallet Services SDK ${version} Released`,
    body: releaseNotes
  });
  
  // Update documentation
  await updateReleaseDocumentation(version, releaseNotes);
}

Release Checklist

Pre-Release

  • All tests passing
  • Code coverage meets threshold
  • Security audit clean
  • Documentation updated
  • Breaking changes documented
  • Migration guide prepared (if needed)
  • Stakeholders notified

Release

  • Version bumped correctly
  • Build pipeline successful
  • Quality gates passed
  • Package published successfully
  • Registry verification completed
  • Release notes published

Post-Release

  • Deployment verified
  • Monitoring alerts configured
  • Consumer applications tested
  • Documentation updated
  • Team notified
  • Release retrospective scheduled

Next Steps:


Navigation: ← Versioning | Deployment Overview | Environments →

⚠️ **GitHub.com Fallback** ⚠️