-
Notifications
You must be signed in to change notification settings - Fork 14
112 lines (108 loc) · 3.94 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
name: ci
on: # yamllint disable-line rule:truthy
push:
branches: [main]
jobs:
build-benchpress:
name: Build .NET solution
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
- name: Initialize Bicep Submodule
run: git submodule update --init --recursive
- name: Build Benchpress Solution
working-directory: BenchPress
run: dotnet build
build-modules:
name: Build the PS Gallery Modules
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
- name: Build Module Files
shell: pwsh
run: |
./build.ps1 -InLine
- name: Archive Module artifacts
uses: actions/upload-artifact@v3
with:
name: benchpress-gallery-module
path: |
./bin/BenchPress.Azure.psd1
./bin/BenchPress.Azure.psm1
local-psgallery:
name: Publish and import from/to local PSGallery
needs: build-modules
runs-on: ubuntu-latest
steps:
- name: Create the local PSGallery folder
shell: pwsh
run: |
$path = New-Item -Path ./packages -ItemType Directory
Register-PSRepository -Name LocalFeedPSRepo -SourceLocation $path.ToString() -PublishLocation $path.ToString() -InstallationPolicy Trusted
- name: Download module artifacts
uses: actions/download-artifact@v3
with:
name: benchpress-gallery-module
path: ./BenchPress.Azure
- name: Publish AzBP Module locally
shell: pwsh
run: |
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
Install-Module -Name Az.App -Scope CurrentUser -Repository PSGallery -Force
Install-Module -Name Az.Search -Scope CurrentUser -Repository PSGallery -Force
Install-Module -Name Az.Portal -Scope CurrentUser -Repository PSGallery -Force
Publish-Module -Path ./BenchPress.Azure -Repository LocalFeedPSRepo -Verbose
- name: Install AzBP Module from the repository
shell: pwsh
run: |
Install-Module BenchPress.Azure -Repository LocalFeedPSRepo
- name: Verify module exposes cmdlets (smoke test)
shell: pwsh
run: |
if ($(Get-Module -Name BenchPress.Azure -ListAvailable).ExportedCommands.Count -eq 0)
{
throw "No commands are available in the BenchPress.Azure Module."
}
build-docs-branch:
name: Build Generated Docs
needs: build-modules
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
- name: Download module artifacts
uses: actions/download-artifact@v3
with:
name: benchpress-gallery-module
path: ./BenchPress.Azure
- name: Create and checkout docs branch
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if [ "$(git ls-remote --exit-code --heads origin docs | wc -l)" -gt 0 ]
then
git fetch origin
git switch docs
else
git checkout -b docs
fi
- name: Generate docs
shell: pwsh
run: |
Install-Module -Name platyPS -Scope CurrentUser -Force
Import-Module platyPS
Import-Module ./BenchPress.Azure/BenchPress.Azure.psd1
New-MarkdownHelp -Module BenchPress.Azure -OutputFolder ./docs -Force
- name: If there are changes push them to docs branch
run: |
if [ "$(git ls-files --deleted --modified --others --exclude-standard -- ./docs | wc -l)" -gt 0 ]
then
git add docs
git commit -m "docs: updating generated documentation"
git push origin docs
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}