Skip to content

Compile + publish

Builds on the basic compile workflow by installing the compiled .app into a running Business Central service tier.

This workflow targets a self-hosted Windows runner with BC already installed and reachable. If you don't have that environment, the basic compile starter is a better fit.

What it does

  1. Checkout, diagnose, compile (same as the basic starter).
  2. Captures the compiled artifact path from the alops-appcompiler step output.
  3. Publishes the resulting .app to a BC service tier with alops-apppublish.
  4. Surfaces the publish step's outputs (e.g., the resolved app version) as workflow outputs.

Prerequisites

  • A self-hosted Windows runner with BC installed and the BC PowerShell modules available.
  • The BC service instance name (e.g., BC230) reachable from the runner.
  • Your ALOps license configured as the ALOPS_LICENSEID repo secret.

The workflow

Copy this into .github/workflows/bc-build-publish.yml:

name: BC Build & Publish

on:
  push:
    branches: [main]
  workflow_dispatch:
    inputs:
      bc_serverinstance:
        description: 'BC server instance name'
        default: 'BC230'

jobs:
  build-publish:
    runs-on: [self-hosted, windows]

    env:
      ALOPS_LICENSEID: ${{ secrets.ALOPS_LICENSEID }}
      BC_SERVERINSTANCE: ${{ github.event.inputs.bc_serverinstance || 'BC230' }}

    outputs:
      app_path: ${{ steps.compile.outputs.artifact_path }}
      build_version: ${{ steps.compile.outputs.build_version }}

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

      - name: Diagnose runner
        uses: HodorNV/ALOps-V3/alops-info@v3   # <!-- TODO: confirm action repo path -->
        with:
          free_mem_threshold: '20'
          free_mem_threshold_action: 'Warn'
          docker_containers_action: 'Ignore'

      - name: Compile
        id: compile
        uses: HodorNV/ALOps-V3/alops-appcompiler@v3   # <!-- TODO: confirm action repo path -->
        with:
          altool_package_version: '17.0.30.49729-beta'
          compilation_mode: 'Serial'
          alsourcepath: ${{ github.workspace }}
          appversiontemplate: '1.0.${{ github.run_number }}.0'
          updatebuildnumber: 'true'

      - name: Publish to BC service tier
        uses: HodorNV/ALOps-V3/alops-apppublish@v3   # <!-- TODO: confirm action repo path -->
        with:
          nav_serverinstance: ${{ env.BC_SERVERINSTANCE }}
          artifact_path: ${{ steps.compile.outputs.artifact_path }}

      - name: Upload .app files
        uses: actions/upload-artifact@v4
        with:
          name: app
          path: '**/*.app'
          if-no-files-found: error

What to tweak

  • bc_serverinstance — the BC instance the publish step targets. Promote this to a repo or environment variable if you have multiple environments (dev / staging / prod).
  • Workflow dispatch input — letting an operator pick the target instance on a manual run is useful for one-off ad-hoc publishes. Drop it if you only ever publish to one instance.
  • Order of steps — for AppSource submissions, you'd add alops-appsource instead of (or after) alops-apppublish.

Outputs

The job outputs two values that downstream jobs (e.g., a release notes job, an AppSource submission job) can consume:

  • app_path — file path of the last compiled .app.
  • build_version — the version string the compiler stamped into the artifact.

Reference them from a downstream job with needs.build-publish.outputs.build_version.