Skip to main content
Matrix42 Self-Service Help Center

Build & Deploy an Extension with GitHub Actions

This is a step-by-step guide on how to use Matrix42 DevOps Services to build and deploy a Digital Workspace Platform Extension using GitHub Actions.

Prerequisites

  • A Matrix42 Cloud Account. (https://accounts.matrix42.com)
  • A GitHub Repository containing the source files of a Digital Workspace Platform Extension.

Configure GitHub Secrets

Some values used inside of the GitHub action should be handled safely since they are sensitive data which should not be visible to anyone having access to the repository.

You can read more about GitHub Secrets here.

In the following example we will need these secrets configured:

Secret Value Description
M42_DEVOPS_PORTAL_PAT Personal Access Token (PAT) of a Matrix42 Cloud Account The Matrix42 Cloud Account you use for this PAT will be the one who uploads the Extension. (Please make sure that the required Permissions are set)
M42_DEVELOPER_IDENTITY Matrix42 Developer Identity

You can read more about Matrix42 Developer Identities here.

Please make sure to base64 encode the contents of your PFX before adding it as a secret.

M42_DEVELOPER_IDENTITY_PASSWORD Password of the Matrix42 Developer Identity  

Create GitHub Action

In the following you will find an example for a GitHub Action which builds & deploys a Matrix42 Digital Workspace Platform Extension.

The GitHub Action uses the Matrix42 Command-Line Interface (CLI). You can read more about how this works here.

For more information the syntax of GitHub Actions you can read here.

name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  workflow_dispatch:

jobs:
  build:
    runs-on: windows-latest
    env:
      EXTENSION_ID: 28e85158-c4b3-4a7d-ab66-6484fbddeb54
    steps:
      - uses: actions/checkout@v2
      - uses: NuGet/setup-nuget@v1.0.5
        with:
          nuget-version: '5.x'
      - run: nuget restore Solutions/Solutions.sln
      - uses: microsoft/setup-msbuild@v1
      - run: msbuild Solutions/Solutions.sln -property:Configuration=Release
      - uses: actions/setup-node@v2.3.2
      - run: npm i @matrix42/cli
      - run: npx m42 login -pat ${{ secrets.M42_DEVOPS_PORTAL_PAT }}
      - run: |
          npx m42 generate-extension -m BasePackage/package.json -o build-${{ github.sha }}.zip -a Solutions/M42ExtensionsGettingStartedBusinessLogic/bin/Release -b ${{ github.run_number }}
      - run: |
          $content = [System.Convert]::FromBase64String("${{ secrets.M42_DEVELOPER_IDENTITY }}")
          [System.IO.File]::WriteAllBytes("identity.pfx", $content)
        shell: powershell
      - run: |
          npx m42 sign -p build-${{ github.sha }}.zip -i identity.pfx -pwd "${{ secrets.M42_DEVELOPER_IDENTITY_PASSWORD }}"
      - run: |
          npx m42 upload-extension -p build-${{ github.sha }}.zip -i ${{ env.EXTENSION_ID }} -e staging

This example is part of an example GitHub repository which you can find here

 

  • Was this article helpful?