Logo

Set up CI/CD

Set up continuous deployment for Blendx apps using GitHub Actions and Azure

Set up continuous deployment for Blendx standalone apps using GitHub Actions.

Prerequisites

  • Azure Container App already created and running
  • GitHub repository access for secrets configuration
  • Azure service principal credentials (or existing credentials from another deployment)

1. Get Required Credentials

Container Registry Credentials

# Get username (usually the registry name)
az acr credential show --name blendappcr --query username -o tsv

# Get password
az acr credential show --name blendappcr --query "passwords[0].value" -o tsv

2. GitHub Secrets Configuration

Go to your GitHub repository → Settings → Secrets and variables → Actions → New repository secret

Add the following secrets:

Secret NameDescription
AZURE_CREDENTIALSAzure service principal JSON (see format below)
CONTAINER_REGISTRY_USERNAMEACR username (usually blendappcr)
CONTAINER_REGISTRY_PASSWORDACR password from Step 1

AZURE_CREDENTIALS Format

{
  "clientSecret": "<client-secret>",
  "subscriptionId": "<subscription-id>",
  "tenantId": "<tenant-id>",
  "clientId": "<client-id>"
}

These values come from the service principal. If these secrets already exist from another deployment, you can reuse them.

3. GitHub Workflow Setup

Create the file .github/workflows/deploy-azure.yml:

name: Deploy to Azure Container Apps

on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20.x"

      - name: Install dependencies
        run: npm install

      - name: Azure Login
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}

      - name: Build and push container image to registry
        uses: azure/container-apps-deploy-action@v1
        with:
          appSourcePath: ${{ github.workspace }}
          registryUrl: blendappcr.azurecr.io
          registryUsername: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
          registryPassword: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
          containerAppName: blendx-app
          resourceGroup: BLEND.APP
          imageToBuild: blendappcr.azurecr.io/blendx-app:${{ github.sha }}
          dockerfilePath: Dockerfile

4. Deployment Process

Automatic Deployment

Push code to the main branch:

git add .
git commit -m "Your changes"
git push origin main

The GitHub Action will automatically trigger and deploy.

Manual Deployment

You can also trigger deployments manually from the Actions tab in GitHub using the "Run workflow" button.

Customization

Update these values in the workflow file for your specific app:

ValueDescription
containerAppNameYour Azure Container App name
resourceGroupYour Azure resource group
imageToBuildDocker image name with your app name
registryUrlYour Azure Container Registry URL

We respect your privacy.

TLDR: We use cookies for language selection, theme, and analytics. Learn more.