Overview
Use this workflow to:- Deploy specific versions to any environment
- Test releases before production deployment
- Promote artifacts across environments (DEV → QA → PROD)
- Create environments dynamically if they don’t exist
- Deploy PR builds for testing specific changes
Triggering the Workflow
This workflow must be triggered manually from the GitHub Actions interface.Workflow Parameters
App version to deploySpecifies which version to deploy:
current: Latest build from the current branchlatest: Most recent successful buildprerelease: Latest prerelease versiondraft: Latest draft release1.0.0: Specific version numberPR_123: Build from pull request #123
latestEnvironment maskTarget environment(s) for deployment:
*: All configured environmentsPROD: Single environment named “PROD”PROD*: All environments starting with “PROD”QA,STAGING: Multiple specific environments (comma-separated)
PRODCreate environment if it does not existWhen true, creates the environment in GitHub and Business Central if missing.Example:
falseWorkflow Jobs
Initialization
Prepares the deployment and validates environment configuration.Actions Performed:
- Reads AL-Go settings
- Determines which environments match the environment mask
- Validates environment configuration
- Checks authentication contexts
- Initiates device code flow if needed (for interactive auth)
*matches all environments in.github/AL-Go-Settings.jsonPROD*matches environments like PROD, PROD-EU, PROD-US- Specific names match exactly
If no authentication context is found for an environment, a device code flow is initiated, requiring manual authentication.
Deploy
Deploys artifacts to the matched environments.Deployment Process:
- Get Artifacts: Downloads the specified version
- Deploy to Business Central: Publishes apps to BC environment
- Deploy to PowerPlatform: If configured, deploys PP solutions
- Runs in parallel for multiple environments
- Uses environment-specific settings and secrets
- Supports both Business Central and PowerPlatform
- Reports deployment URL in environment summary
Environment Configuration
Setting Up Environments
Create GitHub Environment
In repository settings, navigate to Environments and create a new environment.Example:
PRODAdd Authentication Secret
Add a secret to the environment or repository:Secret name: Alternative (Username/Password - not recommended for production):
PROD-AuthContext or PROD_AuthContextSecret value (Service-to-Service):Environment Authentication Methods
Service-to-Service (S2S)
Recommended for automationUses Azure AD app registration with client secret or certificate.
- Secure and automated
- No user interaction required
- Supports certificate-based auth
Device Code Flow
Interactive authenticationInitiated when no auth context is found.
- Requires manual login
- Shows device code in workflow summary
- Useful for one-time or test deployments
App Version Options
Deploying Different Versions
- Latest Build
- Current Branch
- Specific Version
- Pull Request
- Prerelease
Deploy the most recent successful build:This uses artifacts from the latest successful CI/CD workflow run.
Multi-Environment Deployment
Deploying to Multiple Environments
Use environment masks to deploy to multiple environments simultaneously:Each environment deployment runs in parallel, speeding up the process when deploying to multiple environments.
PowerPlatform Deployment
For Per-Tenant Extension repositories with PowerPlatform solutions:Dynamic Environment Creation
WhencreateEnvIfNotExists is enabled, the workflow can create environments on-the-fly.
Requirements
For dynamic environment creation, configure these secrets/variables:Authentication context for the environment (see format above).
Name of the Business Central environment to create.Example:
MyNewEnvironmentEnvironment scope:
Production or SandboxExample: SandboxBuild Modes
The workflow respects build mode configuration for deployments:- Default: Standard build artifacts
- Clean: Clean build artifacts
- Translated: Localized/translated artifacts
Default.
Deployment Strategy
The workflow uses intelligent deployment strategies:Dependency Order
Apps are deployed in dependency order:- Base/framework apps
- Apps with dependencies on base apps
- Apps with dependencies on other apps
- Test apps (if included)
Upgrade vs. Install
- Existing apps: Upgraded to new version
- New apps: Installed for the first time
- Removed apps: Not automatically uninstalled
Schema Sync
The deployment:- Synchronizes database schema
- Runs data upgrade code
- Validates compatibility
Monitoring Deployments
Workflow Output
The workflow provides detailed output:- Environment URL: Link to deployed environment
- Deployment logs: Detailed logs for each app
- Error messages: Clear error reporting if deployment fails
- Artifact information: Which versions were deployed
GitHub Environments
Deployments appear in the Environments section:- View deployment history
- See currently deployed versions
- Access environment URLs
- Review deployment protection rules
Permissions and Security
Required Permissions
Environment Protection Rules
Configure protection rules in GitHub:- Required reviewers: Require approval before deployment
- Wait timer: Delay deployment for a specified time
- Deployment branches: Restrict which branches can deploy
Production environments should always have protection rules to prevent accidental deployments.
Example Scenarios
Scenario 1: Deploy Latest to Production
Scenario 2: Test PR in Staging
Scenario 3: Deploy to All QA Environments
Troubleshooting
Authentication Failed
Verify the auth context secret is correctly formatted and has valid credentials. Check Azure AD app permissions.
Environment Not Found
Ensure the environment exists in GitHub settings and is listed in AL-Go-Settings.json.
Artifacts Not Found
Check that the specified appVersion exists. Verify workflow runs and releases.
Deployment Timeout
Large apps may timeout. Increase timeout or deploy in smaller batches.