Skip to content

feat(finances): add field union types + update RU guides index (tasks… #121

feat(finances): add field union types + update RU guides index (tasks…

feat(finances): add field union types + update RU guides index (tasks… #121

Workflow file for this run

name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write # Required for gh-pages deployment
jobs:
# ============================================================================
# Job 1: Quality Assurance (CI)
# Runs on multiple Node.js versions for compatibility testing
# ============================================================================
ci:
name: CI (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x]
steps:
# 1. Checkout code
- name: Checkout code
uses: actions/checkout@v4
# 2. Setup Node.js
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# 3. Install dependencies
- name: Install dependencies
run: npm ci
# 4. Code quality checks
- name: Run linting
run: npm run lint
- name: Run type checking
run: npm run type-check
# 5. Documentation validation
- name: Validate documentation links
run: npm run validate:links
- name: Validate documentation examples
run: npm run validate:examples
# 6. Testing
- name: Run tests
run: npm test
- name: Generate coverage report
run: npm run test:coverage
# 7. Build validation
- name: Build project
run: npm run build
- name: Validate build artifacts
run: |
test -d dist || exit 1
test -f dist/esm/index.js || exit 1
test -f dist/cjs/index.cjs || exit 1
test -f dist/esm/index.d.ts || exit 1
echo "✓ Build artifacts validated successfully"
# 8. Coverage upload (Node 20.x only)
- name: Upload coverage to Codecov
if: matrix.node-version == '20.x'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
# 9. Generate API documentation (Node 20.x only)
- name: Generate API documentation
if: matrix.node-version == '20.x'
run: npm run docs:api
- name: Validate API documentation
if: matrix.node-version == '20.x'
run: |
test -d docs/api || exit 1
test -f docs/api/modules.md || exit 1
test -d docs/api/classes || exit 1
test -d docs/api/interfaces || exit 1
echo "✓ API documentation (Markdown) validated successfully"
# 10. Upload API docs artifact for deployment job
- name: Upload API docs artifact
if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v4
with:
name: api-docs
path: docs/api/
retention-days: 30
# ============================================================================
# Job 2: Documentation Deployment
# Depends on successful CI, deploys only on main branch
# ============================================================================
deploy:
name: Deploy Documentation
needs: ci # Wait for CI to complete successfully
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
# 1. Checkout code
- name: Checkout code
uses: actions/checkout@v4
# 2. Setup Node.js
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
# 3. Install dependencies
- name: Install dependencies
run: npm ci
# 4. Download API docs from CI job
- name: Download API docs artifact
uses: actions/download-artifact@v4
with:
name: api-docs
path: docs/api/
# 5. Build VitePress documentation
- name: Build VitePress documentation
env:
NODE_ENV: production
run: npm run docs:build
- name: Validate documentation output
run: |
test -d docs/.vitepress/dist || exit 1
test -f docs/.vitepress/dist/index.html || exit 1
echo "✓ Documentation build validated successfully"
# 6. Extract version for commit message
- name: Extract SDK version
id: version
run: echo "SDK_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
# 7. Deploy to GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/.vitepress/dist
publish_branch: gh-pages
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: 'docs: deploy v${{ env.SDK_VERSION }} - ${{ github.sha }}'
enable_jekyll: false
# 8. Deployment confirmation
- name: Deployment complete
run: |
echo "✓ Documentation deployed successfully!"
echo "📚 Visit: https://salacoste.github.io/daytona-wildberries-typescript-sdk/"
echo "📦 Version: v${{ env.SDK_VERSION }}"
echo "🔗 Commit: ${{ github.sha }}"