{"id":13599292,"url":"https://github.com/ili101/Module.Template","last_synced_at":"2025-04-10T12:32:03.794Z","repository":{"id":91612526,"uuid":"67506222","full_name":"ili101/Module.Template","owner":"ili101","description":"Powershell Module Template with GitHub, PowerShellGallery and AppVeyor.","archived":false,"fork":false,"pushed_at":"2019-10-07T11:35:04.000Z","size":97,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-07T00:41:33.383Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ili101.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-09-06T12:30:08.000Z","updated_at":"2024-10-09T15:46:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"54116e88-ddf7-4972-b618-e7e312f18677","html_url":"https://github.com/ili101/Module.Template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ili101%2FModule.Template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ili101%2FModule.Template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ili101%2FModule.Template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ili101%2FModule.Template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ili101","download_url":"https://codeload.github.com/ili101/Module.Template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248217131,"owners_count":21066633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T17:01:01.868Z","updated_at":"2025-04-10T12:32:02.447Z","avatar_url":"https://github.com/ili101.png","language":"PowerShell","readme":"# Module.Template\nPowershell Module Template with GitHub, PowerShellGallery, AppVeyor and Azure DevOps Pipelines integration.\u003cBR /\u003e\nCan be used as a starting point for your open source Module.\n\n[![PowerShell Gallery](https://img.shields.io/powershellgallery/v/Module.Template.svg)](https://www.powershellgallery.com/packages/Module.Template/)\n[![Downloads](https://img.shields.io/powershellgallery/dt/Module.Template.svg)](https://www.powershellgallery.com/packages/Module.Template/)\n\n| CI System    | Environment                   | Master                                                                                                                                                                                                                                         | Beta                                                                                                                                                                                                                                       |\n|--------------|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| AppVeyor     | Windows, Core preview, Ubuntu | [![Build status](https://ci.appveyor.com/api/projects/status/fyuu9hnl68ttn35n/branch/master?svg=true)](https://ci.appveyor.com/project/ili101/Module-Template)                                                                                 | [![Build status](https://ci.appveyor.com/api/projects/status/fyuu9hnl68ttn35n/branch/Beta?svg=true)](https://ci.appveyor.com/project/ili101/Module-Template)                                                                               |\n| Azure DevOps | Windows                       | [![Build Status](https://dev.azure.com/ili101/Module.Template/_apis/build/status/ili101.Module.Template?branchName=master\u0026jobName=Windows)](https://dev.azure.com/ili101/Module.Template/_build/latest?definitionId=1\u0026branchName=master)       | [![Build Status](https://dev.azure.com/ili101/Module.Template/_apis/build/status/ili101.Module.Template?branchName=Beta\u0026jobName=Windows)](https://dev.azure.com/ili101/Module.Template/_build/latest?definitionId=1\u0026branchName=Beta)       |\n| Azure DevOps | Windows (Core)                | [![Build Status](https://dev.azure.com/ili101/Module.Template/_apis/build/status/ili101.Module.Template?branchName=master\u0026jobName=WindowsPSCore)](https://dev.azure.com/ili101/Module.Template/_build/latest?definitionId=1\u0026branchName=master) | [![Build Status](https://dev.azure.com/ili101/Module.Template/_apis/build/status/ili101.Module.Template?branchName=Beta\u0026jobName=WindowsPSCore)](https://dev.azure.com/ili101/Module.Template/_build/latest?definitionId=1\u0026branchName=Beta) |\n| Azure DevOps | Ubuntu                        | [![Build Status](https://dev.azure.com/ili101/Module.Template/_apis/build/status/ili101.Module.Template?branchName=master\u0026jobName=Ubuntu)](https://dev.azure.com/ili101/Module.Template/_build/latest?definitionId=1\u0026branchName=master)        | [![Build Status](https://dev.azure.com/ili101/Module.Template/_apis/build/status/ili101.Module.Template?branchName=Beta\u0026jobName=Ubuntu)](https://dev.azure.com/ili101/Module.Template/_build/latest?definitionId=1\u0026branchName=Beta)        |\n| Azure DevOps | macOS                         | [![Build Status](https://dev.azure.com/ili101/Module.Template/_apis/build/status/ili101.Module.Template?branchName=master\u0026jobName=macOS)](https://dev.azure.com/ili101/Module.Template/_build/latest?definitionId=1\u0026branchName=master)         | [![Build Status](https://dev.azure.com/ili101/Module.Template/_apis/build/status/ili101.Module.Template?branchName=Beta\u0026jobName=macOS)](https://dev.azure.com/ili101/Module.Template/_build/latest?definitionId=1\u0026branchName=Beta)         |\n\n## Install\nFrom repository (Recommended)\n```PowerShell\nInstall-Module -Name Module.Template -Scope CurrentUser\n```\nFrom GitHub Branch (For testing)\n```PowerShell\n$Uri = 'https://raw.githubusercontent.com/ili101/Module.Template/master/Install.ps1'; \u0026 ([Scriptblock]::Create((irm $Uri))) -FromGitHub $Uri\n```\n\n## Instructions\n### Setup\n1. Create a GitHub Repository (Recommended name is the name of the Module) and clone the repository with VSCode.\n2. Clone or download this repository and copy the files to your repository clone.\n3. Remove/Replace/Edit/Rename the files `Module.Template.psm1`, `Module.Template.psm1`, `Invoke-ExampleCommand.ps1`, `Class.ps1` with your module files.\n4. Remove/Replace/Edit/Rename the file `Tests\\Invoke-ExampleCommand.Tests.ps1` with tests for your Module, you can create multiple test files in the folder ending with **.Tests.ps1**.\n5. Edit `README.md`, `CHANGELOG.md` and the `Examples` folder to provide documentation for the Module.\n6. `Install.ps1` is used to \"build\" the module and put it in the PowerShell Modules folder, adjust the `$IncludeFiles` and `$ExcludeFiles` variables if needed to configure which files and folders to copy from the source root folder. Can be used locally by executing `Install.ps1` or remotely from GitHub by the Install command mentiond in the `README.md`. (Also used in the CI procedure).\n7. To use AppVeyor create an account on https://www.appveyor.com/ and connect it to the GitHub repository, the `appveyor.yml` file is used for the configuration.\n8. To use Azure DevOps Pipelines create an account on https://dev.azure.com and connect it to the GitHub repository, the `azure-pipelines.yml` file is used for the configuration.\n### CI Configuration and usage\n**Triggers** - When Pushing a Commit to GitHub AppVeyor and Azure will be triggered unless the Commit contain only changes to the **.md** files or the skip tags [skip azp] (for Azure) and/or [skip av] (for AppVeyor) are added to the Commit name.\u003cBR /\u003e\nThis behavior can be adjusted in the .yml files (`azure-pipelines.yml` do not support wildcards in the file names under trigger:paths:exclude).\u003cBR /\u003e\nAdditionally to run a quick test locally in VSCode click F5 (verify debug is set to \"PowerShell Pester Tests\" in the debug section, this is set in `.vscode\\launch.json`)\n\n**PowerShell Version and OS** - AppVeyor set to test on Ubuntu, Windows Framework and Windows Core.\u003cBR /\u003e\nFor Windows Core you can control the version by setting it in the line `- ps: '\u0026 .\\CI\\InstallPowerShell.ps1 -Version \"7.0.0-preview.4\"'` or comment the line out to use the default version.\nFor Ubuntu you can change or comment out the line with the `sudo apt-get install -y powershell-preview`.\u003cBR /\u003e\nAzure test on Windows Framework and Ubuntu, add/remove jobs in the .yml file to change it.\n\n**Test Results** - The Pester test results are published to AppVeyor Tests tab by the `.\\CI\\CI.ps1 -Finalize` line, and to the Azure Tests tab by the `PublishTestResults@2` task.\n\n**Artifacts** - Artifacts are Zip files created for later use, Artifact with the Windows Framework Module is uploaded to the AppVeyor Artifacts tab by the `.\\CI\\CI.ps1 -Artifact` line, Artifact with the Windows Framework Module and Artifact with the Git Source is uploaded to Azure by the `.\\CI\\CI.ps1 -Artifact` segment.\n\n**Publish to PowerShell Gallery** - You can publish the Module to the PowerShell Gallery in 3 ways:\u003cBR /\u003e\n1. AppVeyor will publish the module automatically if the commit is made in the GitHub master branch and the module version in the .psd file is newer from the version in the gallery.\u003cBR /\u003e\nFor this to work you need to go to [AppVeyor](https://www.appveyor.com/) \u003e project \u003e settings and under Environment add an \"encrypted\" environment variable named \"NugetApiKey\" with your PowerShell Gallery Key.\u003cBR /\u003e\nTo disable this comment out the `- ps: '$null = Install-PackageProvider -Name NuGet -Force ; \u0026 .\\CI\\Publish.ps1'` line\n\n1. In Azure you can publish the module manually from an Artifacts. For this to work you need to configure a \"Releases\" in Azure, I didn't find a way to configure it in the .yml, but I exported it to json `CI\\Azure Publish config.json`, import it in [Azure](https://dev.azure.com) \u003e Releases (You may need to create an empty releases, save it, view releases, New \u003e Import and delete the empty release. Microsoft can create the worst interfaces known to man).\u003cBR /\u003e\nAfter importing in the Artifacts stage \"Artifacts\" will point to \"Module.Template\" delete \"Artifacts\" and recreate it pointing to your Project, If something show in red fix it (For example in \"Publish Job\" if the OS is not set select \"windows-2019\"). Then in the release configuration Variable tab add a \"Secret\" \"Publish Stage\" pipeline variable named \"NugetApiKey\" with your PowerShell Gallery Key.\u003cBR /\u003e\nTo publish click \"Create a new release\" and select the Build version containing the Artifact to use for the release.\u003cBR /\u003e\n(You can delete the `CI\\Azure Publish config.json` file)\n\n1. You can also run `CI\\Publish.ps1` locally with `-NugetApiKey \u003cKey\u003e`\n\n**Publish to Docker Hub** - You can also publish the Module to Docker Hub (Can be good for testing new builds). You can optionally modify the Docker build by editing `CI\\Dockerfile`.\nThe steps are the same as the PowerShell Gallery publish. In Azure \u003e Releases import `CI\\Azure Docker config.json`, Recreate \"Artifacts\" so it point to your Project, If something show in red fix it (Set the OS to Windows or Linux according to the OS configured in `CI\\Dockerfile`), In \"Docker Stage\" \u003e \"buildAndPush\" \u003e \"Container registry\" set your Docker Hub credentials. You can delete the `CI\\Azure Docker config.json` file.\n\n**ScriptAnalyzer** - A ScriptAnalyzer report is generated and saved in Azure Pipelines \u003e Artifacts \u003e Source \u003e `ScriptAnalyzer.xlsx`. In a PR the report will include the PR analysis and the target branch analysis.\u003cBR /\u003e\nTo disable this comment out the `- powershell: './CI/CI.ps1 -Analyzer'` section in the Azure yaml.\n\n##  Changelog\n[CHANGELOG.md](https://github.com/ili101/Module.Template/blob/master/CHANGELOG.md)\n\n## Contributing\nIf you fund a bug or added functionality or anything else just fork and send pull requests. Thank you!\u003cBR /\u003e\nIdeas for new functionality and feature requests are welcomed, you can post your ideas in the \"Issues\" section.\n\n## To do\n* Noting for now, You can open an Issues if something is needed.\n\n## Examples\n[Invoke-ExampleCommand.Examples.ps1](https://github.com/ili101/Module.Template/blob/master/Examples/Invoke-ExampleCommand.Examples.ps1)\n```PowerShell\nInvoke-ExampleCommand\n```\n\n![](https://raw.githubusercontent.com/ili101/Module.Template/master/Examples/Example1.png)\n","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fili101%2FModule.Template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fili101%2FModule.Template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fili101%2FModule.Template/lists"}