Skip to content

Commit f1dee83

Browse files
Adding the SimpleModule scripts
1 parent 04a5eab commit f1dee83

File tree

10 files changed

+369
-1
lines changed

10 files changed

+369
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All changes to this module should be reflected in this document.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [[1.0.0]](https://github.com/mod-posh/LocalAutomation/releases/tag/v1.0.0) - 2023-01-14
8+
## [[1.0.0]](https://github.com/mod-posh/LocalAutomation/releases/tag/v1.0.0) - 2023-01-22
99

1010
The initial release contains the base files as they are from existing repositories with some sanitizing and cleanup.
1111

@@ -15,5 +15,11 @@ The initial release contains the base files as they are from existing repositori
1515
2. discord.json : You will need to get a [Webhook Url](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) if you wish to post to Discord
1616
3. github.json : You will need to create a [Github PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
1717
4. nuget.config : You will need to create a [PowerShell Gallery PAT](https://learn.microsoft.com/en-us/powershell/scripting/gallery/concepts/publishing-guidelines?view=powershell-7.3) to publish to the PowerShell Gallery
18+
2. Simmple Modules
19+
1. psakefile
20+
1. ado.json
21+
2. discord.json
22+
3. github.json
23+
4. nuget.config
1824

1925
---

SimpleModules/MyModule/MyModule.psd1

Whitespace-only changes.

SimpleModules/MyModule/public/GetModuleFunction.ps1

Whitespace-only changes.

SimpleModules/MyModule/public/MyModule.psm1

Whitespace-only changes.

SimpleModules/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Simple Modules
2+
3+
Enclosed are the files I use to build and deploy PowerShell script modules that are composed of multiple Nested PowerShell modules. The basic file structure is included so you have an idea of what it should look like. There are several Modules that are required and the Tasks will check for them at the start.
4+
5+
## Dependencies
6+
7+
You will need to have the following modules installed :
8+
9+
1. BuildHelpers : This is used to help build the Module Manifest as well as the Module file
10+
2. PowerShellForGitHub : This is used for the ReleaseNotes task
11+
3. PlatyPS : This is used to set up and build the help documents
12+
4. Pester : This is the testing framework
13+
14+
Please see the [psakefile](psakefile.ps1) for the versions currently used.
15+
16+
## Supporting Files
17+
18+
There are several files used to help authenticate to various services and depending on your needs you may not need them or you may need something different. You can use them as is, but you will need to populate the various tokens and keys yourself. Also if there is not something you need you can use them as a template.
19+
20+
### ado.json
21+
22+
This file is used to authenticate into the Azure DevOps Rest API, you will need a token for this so please consult the [Documentation](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows). I include three items :
23+
24+
1. Orgname : The name of the Azure DevOps organization
25+
2. Token : The PAT Token
26+
3. Expiration : The expiration date
27+
28+
I include the Expiration so I can get a visual indication of how long before I need to renew the token, there is logic within the psakefile to display that out when you run it.
29+
30+
### discord.json
31+
32+
This file is used to post a message to Discord, I have a server that I set up and I post updates to channels for each of the modules that I use. If you wish to use the Post2Discord you will need to have a Discord account, set up a personal server and get the webhook url, please consult the [Documentation](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks).
33+
34+
### github.json
35+
36+
This file is used to authenticate into the Github API, you will need to set up a token for this so please consult the [Documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). This is used for the ReleaseNotes task.
37+
38+
### nuget.config
39+
40+
This file was originally setup to publish to nuget.org and the PowerShell Gallery, I've left it as is, as I use the same file for publishing some of my code to nuget.org. You will need to create an API Key for this, please consult the [Documentation](https://learn.microsoft.com/en-us/powershell/scripting/gallery/concepts/publishing-guidelines?view=powershell-7.3).
41+
42+
## PsakeFile
43+
44+
This is the main file from which all automation is kicked off. I will go through the basic usage of this file, but for details on setting up for your use, please refer to the file itself. The Psakefile contains a collection of Tasks for more details on how to setup and use Psake please consult the [Documentation](https://psake.readthedocs.io/en/latest/). I will cover the basic tasks that I use so you have an understanding of how they work.
45+
46+
### Localuse
47+
48+
This task is run regularly, this is used to compile the module after local changes so I can test functionality. It basically runs a Build but does not do any of the testing that would normally go along with it.
49+
50+
### Build
51+
52+
This task runs LocalUse but also runs the PesterTests, so make sure you have some of those, otherwise remove the reference to the PesterTest Task. For more information on setting up Tests please refer to the [Documentation](https://pester.dev/docs/quick-start).
53+
54+
### Package
55+
56+
This task builds the help files, packages them up for deployment as well as updates the README.
57+
58+
### Deploy
59+
60+
This task will check to make sure we have checked out the Deployment Branch, the deployment should fail if we are not in the deployment branch. It will then create the Realease Notes, these are compiled from the Github Milestones, if you are not using them remove the reference to this task. It will then Publish the module to the PowerShellGallery, create and push a Tagged release as well are create the Github Release, and finally post a message to Discord, if you are not using Discord remove the reference to this task.

SimpleModules/ado.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"ADOOrganization": {
3+
"OrgName": "",
4+
"Expiration": "",
5+
"Token": ""
6+
},
7+
"ADOOrganization": {
8+
"OrgName": "",
9+
"Expiration": "",
10+
"Token": ""
11+
}
12+
}

SimpleModules/discord.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"uri": "https://discord.com/api/webhooks/",
3+
"message": {
4+
"content": "This is a test message"
5+
}
6+
}

SimpleModules/github.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"Token": ""
3+
}

SimpleModules/nuget.config

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<config>
4+
<add key="defaultPushSource" value="https://www.powershellgallery.com/api/v2/package/" />
5+
</config>
6+
<packageSources>
7+
<clear />
8+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
9+
<add key="PowershellGallery" value="https://www.powershellgallery.com/api/v2/package/" />
10+
</packageSources>
11+
<apikeys>
12+
<add key="PowershellGallery" value="" />
13+
</apikeys>
14+
</configuration>

0 commit comments

Comments
 (0)