Skip to main content
Chargeworx uses GitHub Actions for continuous integration and deployment. The platform leverages a centralized workflow system from the clickworx-org/org-workflows repository.

Workflow configuration

The main workflow is defined in .github/workflows/composite.yml:
name: composite

on:
  push:
    branches:
      - main
      - master
      - develop
      - "hotfix/**"
      - sharpdev/master
      - sharpdev/main
      - "feature/**"
      - "bugfix/**"
      - "sharpdev/release/**"

jobs:
  composite:
    uses: clickworx-org/org-workflows/.github/workflows/composite-workflow.yml@main
    with:
      reviewers: ${{ vars.CWRX_REVIEWERS }}
      assignees: ${{ vars.CWRX_REVIEWERS }}
    secrets:
      access-token: ${{ secrets.GH_PAT }}

Trigger branches

The workflow triggers on pushes to:
  • main/master - Production deployments
  • develop - Development environment
  • hotfix/* - Emergency production fixes
  • feature/* - Feature branch builds
  • bugfix/* - Bug fix builds
  • sharpdev/* - Developer-specific branches

Build process

The composite workflow handles:
  1. Code checkout - Retrieves source code from repository
  2. Dependency restoration - Restores NuGet packages
  3. Compilation - Builds .NET projects
  4. Unit tests - Runs test suite
  5. Artifact packaging - Creates deployment packages
  6. Deployment trigger - Initiates AWS CodeDeploy

AWS CodeDeploy integration

Application structure

The repository contains multiple appspec.yml files for different deployment scenarios:

Root appspec.yml

Deploys both API and Admin applications:
version: 0.0
os: windows
files:
  - source: \#chargeworx.api.project.folder#
    destination: D:\APP-CODE\#chargeworx.api.project.folder#
  - source: \#chargeworx.admin.project.folder#
    destination: D:\APP-CODE\#chargeworx.admin.project.folder#
hooks:
  BeforeInstall:
    - location: before-install.ps1
      timeout: 900
  AfterInstall:
    - location: after-install.ps1
      timeout: 900

Individual project appspec.yml

Each project has its own deployment configuration:
version: 0.0
os: windows
files:
  - source: \
    destination: D:\APP-CODE\#project.folder#
hooks:
  BeforeInstall:
    - location: before-install.ps1
      timeout: 900
  AfterInstall:
    - location: after-install.ps1
      timeout: 900

Deployment hooks

BeforeInstall hook

The before-install.ps1 script prepares the environment:
  • Stops IIS application pools
  • Stops Windows services
  • Backs up current deployment
  • Clears temporary files

AfterInstall hook

The after-install.ps1 script completes deployment:
  • Starts IIS application pools
  • Starts Windows services
  • Verifies application health
  • Configures logging (SumoLogic)
  • Runs database migrations (if needed)

Environment-specific builds

Each environment uses specific build configurations:
  • Development
  • Staging
  • Alpha
  • Production
  • Branch: develop
  • Configuration: appsettings.Development.json
  • Database: Development SQL Server
  • Identity Server: Development instance

Build artifacts

The build process creates deployment packages containing:
  • Compiled application binaries
  • Configuration files
  • Static assets (wwwroot)
  • AWS CodeDeploy scripts
  • Database migration scripts

Monitoring deployments

GitHub Actions

Monitor workflow execution in GitHub:
  1. Navigate to repository Actions tab
  2. Select workflow run
  3. View job logs and status
  4. Check deployment artifacts

AWS CodeDeploy console

Track deployment progress in AWS:
  1. Open AWS CodeDeploy console
  2. Select application
  3. View deployment status
  4. Check deployment logs
  5. Monitor instance health

Troubleshooting

Build failures

Common issues and solutions:
  • Verify package source configuration
  • Check network connectivity
  • Clear NuGet cache
  • Verify authentication credentials
  • Review build logs for specific errors
  • Verify .NET SDK version
  • Check for missing dependencies
  • Ensure code compiles locally
  • Review test output logs
  • Check database connectivity
  • Verify test data setup
  • Run tests locally to reproduce

Deployment failures

  • Check instance connectivity
  • Verify CodeDeploy agent status
  • Review deployment logs
  • Increase timeout in appspec.yml
  • Review PowerShell script logs
  • Check file permissions
  • Verify IIS configuration
  • Test scripts manually on instance
  • Verify application started successfully
  • Check IIS application pool status
  • Review application logs
  • Test health endpoint manually

Best practices

Branch strategy

Follow GitFlow branching model for organized releases

Pull requests

Require PR reviews before merging to protected branches

Automated testing

Maintain comprehensive test coverage for CI validation

Deployment windows

Schedule production deployments during low-traffic periods