Using GitHub Actions to Automate Windows Integration Service (WIS) Builds

GitHub Actions for WIS
Using GitHub Actions to Automate Windows Integration Service (WIS) Builds
Image of Vaibhav Warhadpande-Senior Solution Architect - Optimizely
Vaibhav Warhadpande
Senior Solution Architect - Optimizely

March 18, 2025

Automate Integration of WIS
Automation is vital for assuring effectiveness, consistency, and trustworthiness in the fast-paced development environment of today. By automating the build and deployment process, organizations utilizing Optimizely’s Windows Integration Service (WIS) may cut down on mistakes made by humans and save time. I’ll walk you through the process of creating a GitHub Action to automate the build and deployment of Optimizely WIS artifacts in this blog post.
A powerful tool for integrating Optimizely Commerce with other systems (particularly ERP) is Optimizely’s Windows Integration Service (WIS). However, creating and deployment of WIS artifacts by manually can be tedious and prone to mistakes.
By automating this process with GitHub Actions, you can:
  • Enhance Consistency: Reduces the possibility of inconsistency due to automation.
  • Improved Reliability: Automated workflows reduce human error.
Discover Our Optimizely Solutions Today!

Setting up the GitHub action

To automate the WIS build process, we’ll create a GitHub Action workflow that builds the solution, packages the WIS artifact, and uploads it as a build artifact. Here is a code snippet for the GitHub Action workflow:
				
					name: Create WIS Artifact
on:
  workflow_call:
    inputs:
      solution-path:
        type: string
        required: true
  #workflow_dispatch:  # Enables manual trigger
jobs:
  create-wis-artifact:
    runs-on: windows-latest

    steps:
      - name: Checkout Project Source
        uses: actions/checkout@v4
        with:
           fetch-depth: 0  
      - name: Build
        uses: ./.github/workflows/dotnet-action-msbuild
        with:
          solution-path: ./src/.InsiteCommerce.sln  

      - name: Package Wis Artifact
        run: |
          Set-PSRepository PSGallery -InstallationPolicy Trusted
          Install-Module -Name powershell-yaml -RequiredVersion 0.4.2
          $wisScriptFile = Get-ChildItem -Path "${{ github.workspace }}" -Filter wis.publish.ps1 -Recurse | Select -First 1
          cd $wisScriptFile.Directory
          ./wis.publish.ps1 "${{ github.workspace }}"
        shell: pwsh

      - name: Upload Wis Artifact
        uses: actions/upload-artifact@v4
        with:
          name: wis-archive
          path: wis.tar.gz


				
			

Checkout the Code

The actions/checkout@v4 action is used in the first step to check out the project source code. The fetch-depth: 0 specifies a complete clone of the repository, which is required for build processes.

Build the Solution

The Build step uses a custom action (./.github/workflows/dotnet-action-msbuild) to build the .NET solution specified by solution-path.

Package the WIS Artifact

The Build step uses a custom action (./.github/workflows/dotnet-action-msbuild) to build the .NET solution specified by solution-path.
Before running the script, the PowerShell Gallery repository is set to trusted, and the powershell-yaml module is installed to handle YAML files if needed.

Upload the Artifact

Finally, the Upload Wis Artifact step uses the actions/upload-artifact@v4 action to upload the packaged WIS artifact (wis.tar.gz) as a build artifact. This artifact can then be downloaded and deployed as needed.
				
					name: Deploy WIS

on:
  workflow_call:
    inputs:
      package-file-path:
        type: string
        required: true
  #workflow_dispatch:  # Enables manual trigger

jobs:
  deploy-wis:
    runs-on: self-hosted

    steps:
      - name: Download Artifact
        uses: actions/download-artifact@v4.0.0
        with:
          #Artifact Name
          name: wis-archive
          #Dest Path
          path: \\WISServerName\wis-deploy 
      - name: Stop WIS Service on Server
        run: |
          echo "Checking WIS Service status..."
          Invoke-Command -ComputerName WISServerName -ScriptBlock {
          $service = Get-Service -Name "Commerce Integration Service" 
          if ($service -and $service.Status -eq 'Running') {
            echo "Stopping WIS Service..."
            Stop-Service -Name "Commerce Integration Service" -Force
            echo "WIS Service stopped successfully."
                } else {
                        echo "WIS Service is already stopped."
                    }
                }
        shell: pwsh

      - name: Extract Artifact on WIS Server
        run: |
          echo "Extracting artifact on WIS server..."
          
            $destinationPath = "\\WISServerName\wis-deploy"
            $archivePath = "$destinationPath\wis.tar.gz"
            $outputpath="\\PRODWISSERVER\C$"
            tar -xvf $archivePath -C $outputpath 
            echo "Artifact extracted successfully."
          
        shell: pwsh
        continue-on-error: true
      - name: Start WIS Service on Server
        run: |
          echo "Starting WIS Service..."
          Invoke-Command -ComputerName PRODWISSERVER -ScriptBlock {
            Start-Service -Name "Commerce Integration Service"
 
            echo "WIS Service started successfully."
          }
        shell: pwsh

				
			

Key Steps in the Workflow

Download the WIS Artifact

The Download Artifact step uses the actions/download-artifact@v4.0.0 action to download the WIS artifact (wis-archive) to the specified path on the WIS server (\\PRODWISSERVER\wis-deploy).

Stop the WIS Service

  • The Stop WIS Service on Server step uses PowerShell to remotely stop the WIS service on the target server (PRODWISSERVER).
  • It checks if the service is running and stops it if necessary. If the service is already stopped, it logs a message indicating so.

Extract the WIS Artifact

  • The Extract Artifact on WIS Server step extracts the downloaded artifact (wis.tar.gz) to the specified output path (\\PRODWISSERVER\C$).
  • The continue-on-error: true flag ensures that the workflow continues even if the extraction fails, allowing for debugging without blocking the pipeline, it will ensure to start stopped WIS service if any error occurred during deployment due to network issue or any extraction issue

Start the WIS Service

  • The Start WIS Service on Server step uses PowerShell to remotely start the WIS service on the target server (PRODWISSERVER).
  • It logs a success message once the service is started.
Make sure you need admin rights to start and stop remote WIS service.
Conclusion
Your development process can be streamlined by using GitHub Actions to automate the build and deployment of Optimizely WIS artifacts. You can also create a build pipeline workflow that saves time and minimizes the chance of errors by following the steps given in this blog. Users can change the workflow to meet their specific project requirements or contact Royal Cyber for additional help or queries.

Author

Poonam Chandersy
Talk With Our Expert

    [recaptcha]

    Recent Blogs
    • MQ and Kafka Integration: Three Coexistence Patterns That Work
      Websites used to be something you built once and basically forgot about. That doesn’t work …
      Read More »
    • Upgrading to Optimizely CMS 13: What Your Team Actually Needs to Decide Before Writing a Line of Code
      Learn how to plan an Optimizely CMS 13 upgrade with .NET 10, Optimizely Graph, Visual …
      Read More »
    • AI Meeting Notes: Automating Summaries and Action Items from Video Content
      Learn how AI meeting notes automate summaries, action items, and insights from video meetings using …
      Read More »