-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
- A PowerShell module repository based on Sampler.
- PowerShell 7 or Windows PowerShell 5.1.
- Access to a PowerShell Universal server for deployment tasks.
- A PowerShell Universal application token for authenticated deployments.
Add the module to the consumer repository's RequiredModules.psd1:
@{
Sampler.PowerShellUniversalTasks = 'latest'
}For released versions, the module can also be installed directly:
Install-PSResource -Name Sampler.PowerShellUniversalTasksAdd the module to ModuleBuildTasks in the consumer repository's build.yaml:
ModuleBuildTasks:
Sampler.PowerShellUniversalTasks:
- 'Task.*'Sampler imports the module and dot-sources the task file through the exported
Task.Publish_PowerShellUniversal alias.
Add a UniversalServer section:
UniversalServer:
UniversalServerUrl: https://psu.example.test
UniversalPSResourceRepositoryName: output
UniversalPSResourceRepositoryUrl: ./output/
UniversalPSResourceRepositoryAutoRemove: true
UniversalRepositoryStagingDirectoryName: PsuRepository
UniversalRepositoryAsModule: false
UniversalUnpinned: trueDo not store UniversalServerAppToken in build.yaml. Supply it as an
environment variable in CI:
$env:UniversalServerAppToken = '<token>'For local development, the tasks also dot-source secrets.local.ps1 from the
consumer repository root when that ignored file exists:
$UniversalServerAppToken = '<token>'Package and deploy the module directly:
BuildWorkflow:
deploy:
- pack
- publish_psu_pull_module_from_psresourcerepoPackage and deploy a complete offline automation repository:
BuildWorkflow:
deploy_repository:
- build
- publish_psu_push_repositoryThe compound tasks intentionally contain only tasks exported by this module.
Keep consumer-specific workflows such as build and pack in the consumer
build.yaml so the task module remains reusable across repositories.
Run workflows through the Sampler entry point:
./build.ps1 -Tasks deploy
./build.ps1 -Tasks deploy_repositoryReview Configuration before deployment and Task Reference for task prerequisites and output details.