Skip to content

Temporary commit of incoming PackageInformation setup. #65

Temporary commit of incoming PackageInformation setup.

Temporary commit of incoming PackageInformation setup. #65

Workflow file for this run

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' }