Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abbgrade/PsBuildTasks
Reusable sources for build, test, release automation of PowerShell modules, written in DotNet/C# or PowerShell.
https://github.com/abbgrade/PsBuildTasks
github-actions powershell vscode
Last synced: 3 months ago
JSON representation
Reusable sources for build, test, release automation of PowerShell modules, written in DotNet/C# or PowerShell.
- Host: GitHub
- URL: https://github.com/abbgrade/PsBuildTasks
- Owner: abbgrade
- Created: 2022-02-21T20:05:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-08T17:58:05.000Z (over 1 year ago)
- Last Synced: 2024-05-23T00:31:11.720Z (6 months ago)
- Topics: github-actions, powershell, vscode
- Language: PowerShell
- Homepage: https://abbgrade.github.io/PsBuildTasks/
- Size: 90.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: Readme.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- jimsghstars - abbgrade/PsBuildTasks - Reusable sources for build, test, release automation of PowerShell modules, written in DotNet/C# or PowerShell. (PowerShell)
README
# Readme
PsBuildTasks provides reusable sources for build, test, release automation of PowerShell modules, written in DotNet/C# or PowerShell.
This includes:
- [InvokeBuild](https://github.com/nightroman/Invoke-Build) tasks. [Details](./tasks/Readme.md).
- [GitHub Actions](https://docs.github.com/en/actions) workflows. [Details](./GitHub/Readme.md).
- [VsCode Tasks](https://code.visualstudio.com/docs/editor/tasks) workflows. [Details](./VsCode/Readme.md).
- A PowerShell module for installation and updates. See [the command reference](./docs/) for descriptions and examples.For details, visit the [GitHub Pages](https://abbgrade.github.io/PsBuildTasks/).
## Getting Started
There is a PowerShell module to manage PsBuildTasks and helps with it's installation.
Get it with `Install-Module -Name PsBuildTasks` from from [PsGallery](https://www.powershellgallery.com/packages/PsBuildTasks).
The next step depends on your project.1. If your project is written in PowerShell or DotNet/C#.
2. If your project supports only Windows or is cross platform and requires matrix tests on Windows and Linux.There are container tasks that update multiple features of PsBuildTasks
### PowerShell Matrix
Go to the project root directory and execute the following script.
Make sure to save your existing code in git, since files may be overwritten.```powershell
Import-Module -Name PsBuildTasks
Install-PsBuildTask -Path . -Task PowerShell-Matrix
$ModuleName = ( Get-Location | Get-Item ).NameInvoke-Build -File .\tasks\PsBuild.Tasks.ps1 -Task UpdatePsBuildTasks
Set-Content -Path .build.ps1 -Value @"
`$ModuleName = '$ModuleName'. `$PSScriptRoot/tasks/Build.Tasks.ps1
. `$PSScriptRoot/tasks/PsBuild.Tasks.ps1task InstallModuleDependencies -Jobs {}
task InstallBuildDependencies -Jobs InstallModuleDependencies, {
Install-Module platyPs
}
task InstallTestDependencies -Jobs InstallModuleDependencies, {}
task InstallReleaseDependencies -Jobs InstallModuleDependencies, {}
"@
```In case you start a module from scratch, create a module structure like this.
```powershell
New-Item src -ItemType Directory
New-ModuleManifest -Path src/$ModuleName.psd1 -RootModule "$ModuleName.psm1"
$local:manifest = Get-Content -Path src/$ModuleName.psd1 | ForEach-Object {
$_ -Replace 'FunctionsToExport', '# FunctionsToExport' -Replace 'CmdletsToExport', '# CmdletsToExport' -Replace 'VariablesToExport', '# VariablesToExport' -Replace 'AliasesToExport', '# AliasesToExport'
}
$local:manifest | Set-Content -Path src/$ModuleName.psd1
New-Item src/Internal -ItemType Directory
New-Item src/Public -ItemType Directory
New-Item test -ItemType Directory
```## Update development version
You can update PsBuildTasks to:
the latest stable version using:
```powershell
Invoke-Build -File .\tasks\PsBuild.Tasks.ps1 -Task UpdatePsBuildTasksTasks; Invoke-Build -File .\tasks\PsBuild.Tasks.ps1 -Task UpdatePsBuildTasks
```a branch of choice using:
```powershell
$PsBuildTaskBranch = 'develop'; Invoke-Build -File .\tasks\PsBuild.Tasks.ps1 -Task UpdatePsBuildTasksTasks; Invoke-Build -File .\tasks\PsBuild.Tasks.ps1 -Task UpdatePsBuildTasks
```## Changelog
See the [changelog](./CHANGELOG.md) file.