Skip to content

Commit e893692

Browse files
Adding publish pipeline (#21)
# Pull Request This aims to add two actions for main build and non-main branch builds. They're pretty similar honestly - but the main branch currently publishes the ALZ module to a hard coded 'beta' channel and other branches will publish to a 'alpha' channel for now. Moved the builds to Ubuntu machines. ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent c333774 commit e893692

File tree

6 files changed

+148
-61
lines changed

6 files changed

+148
-61
lines changed

.github/workflows/MainBuild.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release-Build
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- '**.md'
8+
- 'docs/**'
9+
jobs:
10+
test:
11+
name: Build, Test & Publish
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
pwsh: [ '7.1.3' ]
17+
steps:
18+
- name: Check out repository
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
- uses: actions/setup-dotnet@v3
23+
with:
24+
dotnet-version: '3.1.x'
25+
- name: Install GitVersion
26+
uses: gittools/actions/gitversion/setup@v0
27+
with:
28+
versionSpec: '5.5.0'
29+
- name: Determine Version
30+
id: gitversion # id to later be referenced
31+
uses: gittools/actions/gitversion/execute@v0
32+
with:
33+
useConfigFile: true
34+
- name: Display the path
35+
shell: pwsh
36+
run: echo ${env:PATH}
37+
- name: Version Display
38+
shell: pwsh
39+
run: $PSVersionTable
40+
- name: Bootstrap
41+
shell: pwsh
42+
run: ./actions_bootstrap.ps1
43+
- name: Test and Build
44+
shell: pwsh
45+
run: Invoke-Build -File .\src\ALZ.build.ps1
46+
- name: Upload pester results
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: pester-results
50+
path: .\src\Artifacts\testOutput
51+
if-no-files-found: warn
52+
- name: Upload zip module archive build
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: zip-archive
56+
path: .\src\Archive
57+
if-no-files-found: warn
58+
- name: Package ALZ Module
59+
shell: pwsh
60+
# hardcode this as beta until we're ready to take this live
61+
run: ./package_ALZ.ps1 -version ${{ steps.gitversion.outputs.majorMinorPatch }} -prerelease beta
62+
- name: Publish ALZ Module
63+
shell: pwsh
64+
run: |
65+
Publish-Module -Path "./ALZ" -NuGetApiKey ${{ secrets.POWERSHELL_GALLERY_KEY }}
66+

.github/workflows/PullRequest.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Branch-Build
2+
on:
3+
pull_request:
4+
paths-ignore:
5+
- '**.md'
6+
- 'docs/**'
7+
8+
jobs:
9+
test:
10+
name: Build & Test
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
pwsh: [ '7.1.3' ]
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
- uses: actions/setup-dotnet@v3
22+
with:
23+
dotnet-version: '3.1.x'
24+
- name: Install GitVersion
25+
uses: gittools/actions/gitversion/setup@v0
26+
with:
27+
versionSpec: '5.5.0'
28+
- name: Determine Version
29+
id: gitversion # id to later be referenced
30+
uses: gittools/actions/gitversion/execute@v0
31+
with:
32+
useConfigFile: true
33+
- name: Display the path
34+
shell: pwsh
35+
run: echo ${env:PATH}
36+
- name: Version Display
37+
shell: pwsh
38+
run: $PSVersionTable
39+
- name: Bootstrap
40+
shell: pwsh
41+
run: ./actions_bootstrap.ps1
42+
- name: Test and Build
43+
shell: pwsh
44+
run: Invoke-Build -File .\src\ALZ.build.ps1
45+
- name: Upload pester results
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: pester-results
49+
path: .\src\Artifacts\testOutput
50+
if-no-files-found: warn
51+
- name: Upload zip module archive build
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: zip-archive
55+
path: .\src\Archive
56+
if-no-files-found: warn
57+
- name: Package ALZ Module
58+
shell: pwsh
59+
run: ./package_ALZ.ps1 -version ${{ steps.gitversion.outputs.majorMinorPatch }} -prerelease ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}
60+
- name: Publish ALZ Module
61+
shell: pwsh
62+
run: |
63+
Publish-Module -Path "./ALZ" -NuGetApiKey ${{ secrets.POWERSHELL_GALLERY_KEY }} -Force

.github/workflows/wf_Windows_Core.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

GitVersion.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
mode: ContinuousDeployment
2+
branches:
3+
feature:
4+
regex: ^(?!^main$).*$
5+
tag: alpha
6+
increment: Inherit
7+
is-release-branch: false
8+
is-mainline: false

package_ALZ.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
param(
2+
[string]$version,
3+
[string]$prerelease = ""
4+
)
5+
6+
New-Item "ALZ" -ItemType Directory -Force
7+
Copy-Item -Path "./src/Artifacts/*" -Destination "./ALZ" -Recurse -Exclude "ccReport", "testOutput" -Force
8+
9+
Update-ModuleManifest -Path "./ALZ/ALZ.psd1" -ModuleVersion $version -Prerelease $prerelease

src/ALZ/ALZ.psd1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
IconUri = 'https://raw.githubusercontent.com/Azure/ALZ-PowerShell-Module/main/docs/rsz_alzlogo.png?token=GHSAT0AAAAAACAOIZ6NBDR7MPRSCNBS3RQUZA4IYUQ'
117117

118118
# ReleaseNotes of this module
119-
ReleaseNotes = 'Thsi is the first release of the ALZ PowerShell Module. This module is currently in preview and is subject to change.'
119+
ReleaseNotes = 'This is the first release of the ALZ PowerShell Module. This module is currently in preview and is subject to change.'
120120

121121
# Prerelease string of this module
122122
Prerelease = 'beta'
@@ -125,9 +125,7 @@
125125
# RequireLicenseAcceptance = $false
126126

127127
# External dependent modules of this module
128-
ExternalModuleDependencies = @(
129-
'Az.Resources'
130-
)
128+
ExternalModuleDependencies = @()
131129

132130
} # End of PSData hashtable
133131

0 commit comments

Comments
 (0)