Nova AI

GitHub & Azure Integration

A comprehensive guide to setting up CI/CD with GitHub Actions and Azure

Seamlessly integrate GitHub & Azure for efficient deployment. This comprehensive guide will help you set up and optimize your Windsurf development environment with automated CI/CD pipelines.

Initial Setup

Prerequisites

  • GitHub account
  • Microsoft Azure account
  • Windsurf CLI installed
  • Node.js and npm

1. GitHub Repository Setup

  1. Create a new repository on GitHub
  2. Clone the repository locally
  3. Initialize your Windsurf project in the repository

GitHub Configuration

Branch Protection Rules

Set up branch protection for your main branch:

  1. Go to Repository Settings > Branches
  2. Add branch protection rule for main branch
  3. Enable "Require pull request before merging"
  4. Enable "Require status checks to pass before merging"

GitHub Actions Workflow

Create .github/workflows/windsurf-ci.yml:

name: Windsurf CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]


jobs:
  build:
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v2
    
    - name: Use Node.js
      uses: actions/setup-node@v2
      with:
        node-version: '16.x'
    
    - name: Install Dependencies
      run: npm ci
    
    - name: Run Build
      run: npm run build
    
    - name: Run Tests
      run: npm test

Azure Deployment

Azure App Service Setup

  1. Create a new Web App in Azure Portal
  2. Select Node.js 16 LTS as the runtime stack
  3. Choose your subscription and resource group
  4. Enable "Deployment Center"

GitHub Integration

  1. In Azure Portal, go to your Web App
  2. Navigate to Deployment Center
  3. Select GitHub as the source
  4. Authorize Azure to access your GitHub account
  5. Select your repository and branch
  6. Configure the build provider (Node.js)

Environment Variables

GitHub Secrets

Add these secrets to your GitHub repository:

  • AZURE_CREDENTIALS - Azure service principal credentials
  • AZURE_WEBAPP_NAME - Your Azure Web App name
  • AZURE_RESOURCE_GROUP - Azure resource group name

Azure Application Settings

Add these to your Azure Web App Configuration:

  • NODE_ENV - Set to 'production'
  • WEBSITE_NODE_DEFAULT_VERSION - ~16
  • SCM_DO_BUILD_DURING_DEPLOYMENT - 1

Workflow Automation

CI/CD Pipeline

Your GitHub Actions workflow will automatically:

  1. Run on every push to main and pull requests
  2. Install dependencies
  3. Run tests
  4. Deploy to Azure on successful build

Custom Domains (Optional)

  1. Go to your Web App in Azure Portal
  2. Navigate to Custom domains
  3. Add your domain and follow the verification steps
  4. Update DNS records with your domain provider

Troubleshooting

Common Issues

Build Failing

Solution: Check GitHub Actions logs for specific error messages. Common issues include missing dependencies or test failures.

Deployment Not Triggering

Solution: Verify GitHub repository settings and Azure deployment center configuration.

Environment Variables Not Loading

Solution: Ensure variables are set in Azure Application Settings and that the app restarts after changes.