-
Notifications
You must be signed in to change notification settings - Fork 8
161 lines (147 loc) · 7.18 KB
/
new-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# 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