Skip to content

Commit 6866d41

Browse files
Merge pull request #26 from leojonathanoh/refactor/ci-bump-psmodulepublisher-to-v0.7.0-cleanup-ci-jobs-and-add-powershell-7.3-test-job
Refactor (ci): Bump PSModulePublisher to v0.7.0, cleanup CI jobs, and add powershell 7.3 test job
2 parents 40cc2c3 + f254068 commit 6866d41

5 files changed

Lines changed: 103 additions & 143 deletions

File tree

.github/workflows/ci-master-pr.yml

Lines changed: 86 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -14,60 +14,24 @@ jobs:
1414
test-powershell-5-1-windows-2019:
1515
runs-on: windows-2019
1616
steps:
17-
- uses: actions/checkout@v2
18-
- name: Display system info (windows)
19-
run: |
20-
Set-StrictMode -Version Latest; $ErrorActionPreference = 'Stop'
21-
hostname
22-
whoami
23-
systeminfo
24-
Get-PSDrive
25-
Get-Location
26-
# pwsh version
27-
$PSVersionTable
28-
# Windows Powershell version?
29-
powershell -Command '$PSVersionTable'
17+
- uses: actions/checkout@v3
3018
- name: Powershell version
3119
run: |
3220
powershell -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
3321
- name: Test
3422
run: |
3523
powershell -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1'
3624
37-
# macos-10-15:
38-
# runs-on: macos-10.15
39-
# steps:
40-
# - uses: actions/checkout@v2
41-
# - name: Display system info (macos)
42-
# run: |
43-
# set -e
44-
# hostname
45-
# whoami
46-
# df -h
47-
# pwd
48-
# # docker info
49-
# # docker version
50-
5125
##########
5226
# Docker #
5327
##########
28+
# Get powershell tags: https://mcr.microsoft.com/v2/powershell/tags/list
5429
test-powershell-6-0:
5530
runs-on: ubuntu-latest
5631
container:
57-
# image: theohbrothers/docker-powershell:6.0.2-ubuntu-16.04-git
58-
image: mcr.microsoft.com/powershell:6.0.2-ubuntu-16.04
32+
image: mcr.microsoft.com/powershell:6.0.4-ubuntu-16.04
5933
steps:
60-
- uses: actions/checkout@v2
61-
- name: Display system info (linux)
62-
run: |
63-
set -e
64-
hostname
65-
whoami
66-
cat /etc/*release
67-
lscpu
68-
free
69-
df -h
70-
pwd
34+
- uses: actions/checkout@v3
7135
- name: Powershell version
7236
run: |
7337
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
@@ -78,21 +42,9 @@ jobs:
7842
test-powershell-6-1:
7943
runs-on: ubuntu-latest
8044
container:
81-
# image: theohbrothers/docker-powershell:6.1.3-alpine-3.8-git
82-
# image: mcr.microsoft.com/powershell:6.1.3-alpine-3.8
8345
image: mcr.microsoft.com/powershell:6.1.3-ubuntu-18.04
8446
steps:
85-
- uses: actions/checkout@v2
86-
- name: Display system info (linux)
87-
run: |
88-
set -e
89-
hostname
90-
whoami
91-
cat /etc/*release
92-
# lscpu
93-
free
94-
df -h
95-
pwd
47+
- uses: actions/checkout@v3
9648
- name: Powershell version
9749
run: |
9850
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
@@ -103,21 +55,9 @@ jobs:
10355
test-powershell-6-2:
10456
runs-on: ubuntu-latest
10557
container:
106-
# image: theohbrothers/docker-powershell:6.2.4-alpine-3.8-git
107-
# image: mcr.microsoft.com/powershell:6.2.4-alpine-3.8
10858
image: mcr.microsoft.com/powershell:6.2.4-ubuntu-18.04
10959
steps:
110-
- uses: actions/checkout@v2
111-
- name: Display system info (linux)
112-
run: |
113-
set -e
114-
hostname
115-
whoami
116-
cat /etc/*release
117-
# lscpu
118-
free
119-
df -h
120-
pwd
60+
- uses: actions/checkout@v3
12161
- name: Powershell version
12262
run: |
12363
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
@@ -128,21 +68,9 @@ jobs:
12868
test-powershell-7-0:
12969
runs-on: ubuntu-latest
13070
container:
131-
# image: theohbrothers/docker-powershell:7.0.3-alpine-3.9-20200928
132-
# image: mcr.microsoft.com/powershell:7.0.3-alpine-3.9
13371
image: mcr.microsoft.com/powershell:7.0.3-ubuntu-18.04
13472
steps:
135-
- uses: actions/checkout@v2
136-
- name: Display system info (linux)
137-
run: |
138-
set -e
139-
hostname
140-
whoami
141-
cat /etc/*release
142-
# lscpu
143-
free
144-
df -h
145-
pwd
73+
- uses: actions/checkout@v3
14674
- name: Powershell version
14775
run: |
14876
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
@@ -153,21 +81,9 @@ jobs:
15381
test-powershell-7-1:
15482
runs-on: ubuntu-latest
15583
container:
156-
# image: theohbrothers/docker-powershell:7.1.3-alpine-3.11-20210316-git
157-
# image: mcr.microsoft.com/powershell:7.1.3-alpine-3.11-20210316
158-
image: mcr.microsoft.com/powershell:7.1.3-ubuntu-18.04
84+
image: mcr.microsoft.com/powershell:7.1.5-ubuntu-20.04
15985
steps:
160-
- uses: actions/checkout@v2
161-
- name: Display system info (linux)
162-
run: |
163-
set -e
164-
hostname
165-
whoami
166-
cat /etc/*release
167-
# lscpu
168-
free
169-
df -h
170-
pwd
86+
- uses: actions/checkout@v3
17187
- name: Powershell version
17288
run: |
17389
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
@@ -178,21 +94,22 @@ jobs:
17894
test-powershell-7-2:
17995
runs-on: ubuntu-latest
18096
container:
181-
# image: theohbrothers/docker-powershell:7.2.0-preview.4-alpine-3.11-20210316-git
182-
# image: mcr.microsoft.com/powershell:7.2.0-preview.4-alpine-3.11-20210316
183-
image: mcr.microsoft.com/powershell:7.2.0-preview.4-ubuntu-18.04
97+
image: mcr.microsoft.com/powershell:7.2-ubuntu-20.04
98+
steps:
99+
- uses: actions/checkout@v3
100+
- name: Powershell version
101+
run: |
102+
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
103+
- name: Test
104+
run: |
105+
pwsh -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1'
106+
107+
test-powershell-7-3:
108+
runs-on: ubuntu-latest
109+
container:
110+
image: mcr.microsoft.com/powershell:7.3-ubuntu-20.04
184111
steps:
185-
- uses: actions/checkout@v2
186-
- name: Display system info (linux)
187-
run: |
188-
set -e
189-
hostname
190-
whoami
191-
cat /etc/*release
192-
# lscpu
193-
free
194-
df -h
195-
pwd
112+
- uses: actions/checkout@v3
196113
- name: Powershell version
197114
run: |
198115
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
@@ -201,54 +118,97 @@ jobs:
201118
pwsh -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1'
202119
203120
update-draft-release:
204-
needs: [test-powershell-5-1-windows-2019, test-powershell-6-0, test-powershell-6-1, test-powershell-6-1, test-powershell-7-0, test-powershell-7-1, test-powershell-7-2]
121+
needs:
122+
- test-powershell-5-1-windows-2019
123+
- test-powershell-6-0
124+
- test-powershell-6-1
125+
- test-powershell-6-2
126+
- test-powershell-7-0
127+
- test-powershell-7-1
128+
- test-powershell-7-2
129+
- test-powershell-7-3
130+
- test-publish-to-psgallery
205131
if: github.ref == 'refs/heads/master'
206132
runs-on: ubuntu-latest
207133
steps:
208134
# Drafts your next Release notes as Pull Requests are merged into "master"
209135
- uses: release-drafter/release-drafter@v5
136+
with:
137+
config-name: release-drafter.yml
138+
publish: false
210139
env:
211140
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
212141

142+
test-publish-to-psgallery:
143+
runs-on: ubuntu-latest
144+
steps:
145+
- uses: actions/checkout@v3
146+
with:
147+
submodules: true
148+
- name: Powershell version
149+
run: |
150+
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
151+
- name: Publish (dry run)
152+
shell: pwsh
153+
env:
154+
MODULE_VERSION: '999.0.0'
155+
NUGET_API_KEY: 'xxx'
156+
run: |
157+
$ErrorActionPreference = 'Stop'
158+
159+
# Generate the new module manifest
160+
$moduleManifest = ./build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Build.ps1
161+
162+
# Publish the module
163+
./build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath $moduleManifest -Repository PSGallery -DryRun
164+
213165
publish-to-psgallery:
214-
needs: [test-powershell-5-1-windows-2019, test-powershell-6-0, test-powershell-6-1, test-powershell-6-1, test-powershell-7-0, test-powershell-7-1, test-powershell-7-2]
166+
needs:
167+
- test-powershell-5-1-windows-2019
168+
- test-powershell-6-0
169+
- test-powershell-6-1
170+
- test-powershell-6-2
171+
- test-powershell-7-0
172+
- test-powershell-7-1
173+
- test-powershell-7-2
174+
- test-powershell-7-3
175+
- test-publish-to-psgallery
215176
if: startsWith(github.ref, 'refs/tags/')
216177
runs-on: ubuntu-latest
217178
steps:
218-
- uses: actions/checkout@v2
179+
- uses: actions/checkout@v3
219180
with:
220181
submodules: true
221182
- name: Powershell version
222183
run: |
223184
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
224185
- name: Publish
186+
shell: pwsh
225187
env:
226188
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
227189
run: |
228-
set -e
229-
230-
# Get 'ref-name' from 'refs/heads/ref-name'
231-
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
190+
$ErrorActionPreference = 'Stop'
232191
233192
# Strip of 'v' prefix from tag
234-
MODULE_VERSION=$( echo "${REF}" | sed 's/^v*//' )
193+
$env:MODULE_VERSION = $env:GITHUB_REF_NAME -replace '^v', ''
235194
236195
# Generate the new module manifest
237-
MODULE_NAME=$(basename $(pwd))
238-
MODULE_VERSION=${MODULE_VERSION} pwsh -Command "build/PSModulePublisher/src/module/Generate-ModuleManifest.ps1 -DefinitionFile build/definitions/modulemanifest/definition.ps1 -Path src/$MODULE_NAME/$MODULE_NAME.psd1"
196+
$moduleManifest = ./build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Build.ps1
239197
240198
# Publish the module
241-
NUGET_API_KEY=${NUGET_API_KEY} MODULE_VERSION=${MODULE_VERSION} pwsh -Command "build/PSModulePublisher/src/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery"
199+
./build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath $moduleManifest -Repository PSGallery
242200
243201
publish-draft-release:
244-
needs: [test-powershell-5-1-windows-2019, test-powershell-6-0, test-powershell-6-1, test-powershell-6-1, test-powershell-7-0, test-powershell-7-1, test-powershell-7-2, publish-to-psgallery]
202+
needs: [publish-to-psgallery]
245203
if: startsWith(github.ref, 'refs/tags/')
246204
runs-on: ubuntu-latest
247205
steps:
248-
- id: release-drafter
249-
uses: release-drafter/release-drafter@v5
250-
with:
251-
# config-name: release-drafter.yaml
252-
publish: true
253-
env:
254-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
206+
# Drafts your next Release notes as Pull Requests are merged into "master"
207+
- uses: release-drafter/release-drafter@v5
208+
with:
209+
config-name: release-drafter.yml
210+
publish: true
211+
name: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
212+
tag: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3'
213+
env:
214+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.vscode/tasks.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"id": "NUGET_API_KEY",
88
"description": "NUGET_API_KEY?",
99
"type": "promptString",
10-
"default": "",
10+
"default": "xxx",
1111
},
1212
{
1313
"id": "MODULE_VERSION",
1414
"description": "MODULE_VERSION?",
1515
"type": "promptString",
16-
"default": "",
16+
"default": "0.0.0",
1717
},
1818
],
1919
"tasks": [
@@ -32,25 +32,25 @@
3232
{
3333
"label": "Build: Generate module manifest",
3434
"type": "shell",
35-
"command": "MODULE_NAME=$(basename $(pwd)); MODULE_VERSION=${input:MODULE_VERSION} pwsh -Command \"build/PSModulePublisher/src/module/Generate-ModuleManifest.ps1 -DefinitionFile build/definitions/modulemanifest/definition.ps1 -Path src/$MODULE_NAME/$MODULE_NAME.psd1\"",
36-
"group": "build"
37-
},
38-
{
39-
"label": "Build: Test module manifest",
40-
"type": "shell",
41-
"command": "MODULE_NAME=$(basename $(pwd)); MODULE_VERSION=${input:MODULE_VERSION} pwsh -Command \"build/PSModulePublisher/src/module/Test-ModuleManifest.ps1 -Path src/$MODULE_NAME/$MODULE_NAME.psd1\"",
35+
"command": "MODULE_VERSION=${input:MODULE_VERSION} pwsh build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Build.ps1",
4236
"group": "build"
4337
},
4438
{
4539
"label": "Publish module (dry run)",
40+
"dependsOn":[
41+
"Build: Generate module manifest"
42+
],
4643
"type": "shell",
47-
"command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh -Command \"build/PSModulePublisher/src/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery -DryRun\"",
44+
"command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery -DryRun",
4845
"group": "build"
4946
},
5047
{
5148
"label": "Publish module",
49+
"dependsOn":[
50+
"Build: Generate module manifest"
51+
],
5252
"type": "shell",
53-
"command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh -Command \"build/PSModulePublisher/src/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery\"",
53+
"command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery",
5454
"group": "build"
5555
},
5656

build/PSModulePublisher

Submodule PSModulePublisher updated 66 files

build/definitions/modulemanifest/definition.ps1 renamed to build/definitions/modulemanifest.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# FormatsToProcess = @()
2424
# NestedModules = @()
2525
FunctionsToExport = @(
26-
Get-ChildItem $PSScriptRoot/../../../src/PSSourceQuery/public -Exclude *.Tests.ps1 | % { $_.BaseName }
26+
Get-ChildItem $PSScriptRoot/../../src/PSSourceQuery/public -Exclude *.Tests.ps1 | % { $_.BaseName }
2727
)
2828
CmdletsToExport = @()
2929
VariablesToExport = @()

0 commit comments

Comments
 (0)