forked from PSAppDeployToolkit/PSAppDeployToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (119 loc) · 6.32 KB
/
Copy pathmodule-build.yml
File metadata and controls
136 lines (119 loc) · 6.32 KB
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
name: PSAppDeployToolkit-Windows-PowerShell
on:
pull_request:
push:
permissions:
id-token: write # Require write permission to Fetch an OIDC token.
contents: read
env:
NUGET_PACKAGES: ${{ github.workspace }}\.nuget\packages
jobs:
test:
name: Run Tests
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
- name: Display the path
shell: powershell
run: echo ${env:PATH}
- name: Version Display
shell: powershell
run: $PSVersionTable
- name: Cache NuGet packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # https://github.com/actions/cache/releases/tag/v5.0.5
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Cache PowerShell modules
id: psmodule-cache
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # https://github.com/actions/cache/releases/tag/v5.0.3
with:
path: ~\Documents\WindowsPowerShell\Modules
key: ${{ runner.os }}-psmodule-PSScriptAnalyzer-1.25.0-Pester-5.7.1-platyPS-0.14.2-Alt3.Docusaurus.Powershell-1.0.37
- name: Install PowerShell modules
if: steps.psmodule-cache.outputs.cache-hit != 'true'
shell: powershell
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name PSScriptAnalyzer -RequiredVersion 1.25.0 -Force -Scope CurrentUser
Install-Module -Name Pester -RequiredVersion 5.7.1 -Force -SkipPublisherCheck -Scope CurrentUser
Install-Module -Name platyPS -RequiredVersion 0.14.2 -Force -Scope CurrentUser
Install-Module -Name Alt3.Docusaurus.Powershell -RequiredVersion 1.0.37 -Force -Scope CurrentUser
- name: Test and Build
shell: cmd
run: powershell.exe -ExecutionPolicy Bypass -File build.ps1
- name: Install AzureSignTool
if: github.repository == 'PSAppDeployToolkit/PSAppDeployToolkit' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/4.0.x' || github.ref == 'refs/heads/4.1.x')
run: dotnet tool install --global azuresigntool
- name: Azure Login
if: github.repository == 'PSAppDeployToolkit/PSAppDeployToolkit' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/4.0.x' || github.ref == 'refs/heads/4.1.x')
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # https://github.com/Azure/login/releases/tag/v3.0.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Sign module source
if: github.repository == 'PSAppDeployToolkit/PSAppDeployToolkit' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/4.0.x' || github.ref == 'refs/heads/4.1.x')
shell: powershell
run: |
Get-ChildItem -Path "$($PWD)\src\Artifacts\ModuleOnly\PSAppDeployToolkit" -Include '*.ps*1', 'PSAppDeployToolkit.dll', 'PSADT*.dll', 'PSADT*.exe', 'Fluence.Wpf.dll', 'Invoke-AppDeployToolkit.exe', 'Microsoft.Windows.SDK.NET.dll', 'WinRT.Runtime.dll' -Recurse | Select-Object -ExpandProperty FullName | Out-File "FilesToSign.txt"
& azuresigntool.exe sign -s -kvu https://psadt-kv-prod-codesign.vault.azure.net -kvc PSADT -kvm -tr http://timestamp.digicert.com -td sha256 -ifl FilesToSign.txt
- name: Generate artifact templates
id: exports
shell: powershell
run: |
& (Import-Module -Name .\src\PSAppDeployToolkit.Build -PassThru) { Invoke-ADTCustomModuleBuild -Actions 'Export-ADTScriptTemplate', 'Compress-ADTBuildAssetContent' }
- name: Upload module
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # https://github.com/actions/upload-artifact/releases/tag/v7.0.1
with:
path: ${{ steps.exports.outputs.ModuleOnly }}
if-no-files-found: error
overwrite: true
archive: false
- name: Upload v3 module template
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # https://github.com/actions/upload-artifact/releases/tag/v7.0.1
with:
path: ${{ steps.exports.outputs.Template_v3 }}
if-no-files-found: error
overwrite: true
archive: false
- name: Upload v4 module template
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # https://github.com/actions/upload-artifact/releases/tag/v7.0.1
with:
path: ${{ steps.exports.outputs.Template_v4 }}
if-no-files-found: error
overwrite: true
archive: false
- name: Upload v4 ZeroConfig module template
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # https://github.com/actions/upload-artifact/releases/tag/v7.0.0
with:
path: ${{ steps.exports.outputs.Template_v4_ZeroConfig }}
if-no-files-found: error
overwrite: true
archive: false
- name: Upload pester results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # https://github.com/actions/upload-artifact/releases/tag/v7.0.1
with:
path: .\src\Artifacts\TestOutput\PesterTests.xml
if-no-files-found: error
overwrite: true
archive: false
- name: Upload code coverage results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # https://github.com/actions/upload-artifact/releases/tag/v7.0.1
with:
path: .\src\Artifacts\CodeCoverage\CodeCoverage.xml
if-no-files-found: error
overwrite: true
archive: false
- name: Generate docs and update website
if: github.repository == 'PSAppDeployToolkit/PSAppDeployToolkit' && (github.ref == 'refs/heads/main')
shell: powershell
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
run: |
& (Import-Module -Name .\src\PSAppDeployToolkit.Build -PassThru) { Invoke-ADTCustomModuleBuild -Actions 'Import-ADTReleaseModule', 'Invoke-ADTMarkdownExport', 'Invoke-ADTDocusaurusExport', 'Publish-ADTDocusaurusExport' }