New package #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creates a Microsoft 365 Apps package and optionally imports into a target Intune tenant | |
# Uses secrets on the repo - TENANT_ID, CLIENT_ID, and CLIENT_SECRET | |
# to import the package into a target tenant | |
name: New package | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
on: | |
workflow_dispatch: | |
inputs: | |
configuration: | |
description: Configuration file | |
type: choice | |
options: | |
- O365ProPlusVisioProRetailProjectProRetail.xml | |
- O365ProPlus.xml | |
- O365BusinessRetail.xml | |
- O365ProPlusVisioProRetailProjectProRetail-VDI.xml | |
- O365ProPlus-VDI.xml | |
- O365BusinessRetail-VDI.xml | |
channel: | |
description: Update channel | |
type: choice | |
options: | |
- MonthlyEnterprise | |
- Current | |
- SemiAnnual | |
- SemiAnnualPreview | |
- CurrentPreview | |
- BetaChannel | |
companyname: | |
description: Company name | |
required: false | |
default: stealthpuppy | |
import: | |
description: "Import (if not selected, download package from pipeline artifacts)" | |
default: true | |
type: boolean | |
jobs: | |
new-package: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Test configuration file path | |
id: test-config | |
shell: powershell | |
working-directory: "${{ github.workspace }}" | |
run: | | |
$params = @{ | |
Path = "${{ github.workspace }}\configs\${{ github.event.inputs.configuration }}" | |
PathType = "Leaf" | |
} | |
if (-not (Test-Path @params)) { throw "Could not find configration file: ${{ github.event.inputs.configuration }}" } | |
- name: Install and cache PowerShell modules | |
id: psmodulecache | |
uses: potatoqualitee/[email protected] | |
with: | |
modules-to-cache: "Evergreen::, MSAL.PS::, IntuneWin32App::" | |
updatable: true | |
shell: powershell | |
- name: Create and Import package | |
id: import-package | |
if: ${{ github.event.inputs.import == 'true' }} | |
shell: powershell | |
working-directory: "${{ github.workspace }}" | |
run: | | |
$params = @{ | |
Path = "${{ github.workspace }}" | |
ConfigurationFile = "${{ github.workspace }}\configs\${{ github.event.inputs.configuration }}" | |
Channel = "${{ github.event.inputs.channel }}" | |
CompanyName = "${{ github.event.inputs.companyname }}" | |
TenantId = "${{ secrets.TENANT_ID }}" | |
ClientId = "${{ secrets.CLIENT_ID }}" | |
ClientSecret = "${{ secrets.CLIENT_SECRET }}" | |
Import = $true | |
Verbose = $true | |
} | |
& "${{ github.workspace }}\New-Microsoft365AppsPackage.ps1" @params | |
- name: Create package artifact only | |
id: create-artifact | |
if: ${{ github.event.inputs.import == 'false' }} | |
shell: powershell | |
working-directory: "${{ github.workspace }}" | |
run: | | |
$params = @{ | |
Path = "${{ github.workspace }}" | |
ConfigurationFile = "${{ github.workspace }}\configs\${{ github.event.inputs.configuration }}" | |
Channel = "${{ github.event.inputs.channel }}" | |
CompanyName = "${{ github.event.inputs.companyname }}" | |
TenantId = "${{ secrets.TENANT_ID }}" | |
ClientId = "${{ secrets.CLIENT_ID }}" | |
ClientSecret = "${{ secrets.CLIENT_SECRET }}" | |
Import = $false | |
Verbose = $true | |
} | |
& "${{ github.workspace }}\New-Microsoft365AppsPackage.ps1" @params | |
- name: Set release parameters | |
id: release | |
shell: pwsh | |
run: | | |
$ConfigurationFile = Get-ChildItem -Path ${{ github.workspace }}\package\output\*.xml | Select-Object -First 1 | |
$FileName = [System.IO.Path]::GetFileNameWithoutExtension($ConfigurationFile) | |
[System.Xml.XmlDocument]$Xml = Get-Content -Path $ConfigurationFile | |
$Channel = $Xml.Configuration.Add.Channel | |
$Date = Get-Date -Format yyyyMMdd | |
$SetupVersion = (Get-Item -Path "${{ github.workspace }}\m365\setup.exe").VersionInfo.FileVersion | |
Import-Module -Name Evergreen | |
$PsadtVersion = Get-EvergreenApp -Name "PSAppDeployToolkit" | Select-Object -ExpandProperty "Version" | |
echo "release=$FileName.$Channel.$Date.${{ github.run_number }}" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append | |
echo "filename=$FileName" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append | |
echo "channel=$Channel" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append | |
echo "setup=$SetupVersion" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append | |
echo "psadt=$PsadtVersion" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Upload artifacts | |
id: upload-artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.release.outputs.release }} | |
path: | | |
${{ github.workspace }}/package/output/* | |
- name: Job summary | |
id: summary | |
shell: pwsh | |
run: | | |
echo "# Package summary :package:" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "Microsoft 365 Apps package created with:" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "- Configuration file: ${{ github.event.inputs.configuration }}" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "- Company name: ${{ github.event.inputs.companyname }}" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "- Update channel: ${{ steps.release.outputs.channel }}" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "- Setup.exe version: ${{ steps.release.outputs.setup }}" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "- PSAppDeployToolkit version: ${{ steps.release.outputs.psadt }}" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
- name: Import success | |
id: import-success | |
if: steps.import-package.outcome == 'success' | |
shell: pwsh | |
run: | | |
echo "## Package imported into Intune :tada:" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
- name: Import failure | |
id: import-fail | |
if: steps.import-package.outcome == 'failure' | |
shell: pwsh | |
run: | | |
echo "## Package failed to into Intune :ng_man:" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
echo "" | Out-File -FilePath $Env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append |