-
-
Notifications
You must be signed in to change notification settings - Fork 3
120 lines (104 loc) · 3.81 KB
/
Copy pathbuild.yml
File metadata and controls
120 lines (104 loc) · 3.81 KB
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
113
114
115
116
117
118
119
120
name: Publish to PowerShell Gallery
# Build and release the PsLogicAppExtractor PowerShell module on every push to main.
# Validation jobs run in parallel with module caching; build-and-release runs after all pass.
on:
push:
branches:
- main
jobs:
general-unit-tests:
name: Validate General Unit Tests
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Cache Powershell Modules
id: cache-powershell-modules
uses: actions/cache@v5
with:
path: ~\Documents\PowerShell\Modules
key: ps-modules-${{ runner.os }}-v1
- name: Install Prerequisites
if: steps.cache-powershell-modules.outputs.cache-hit != 'true'
shell: pwsh
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
$modules = @('Pester','PSFramework','PSModuleDevelopment','PSScriptAnalyzer','psake')
foreach ($module in $modules) {
Write-Host "Installing $module..."
Install-Module -Name $module -Scope CurrentUser -Force -SkipPublisherCheck
}
- name: Validate
shell: pwsh
run: build\vsts-validate.ps1 -TestGeneral $true -TestFunctions $false
individual-unit-tests:
name: Validate Individual Unit Tests
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Cache Powershell Modules
id: cache-powershell-modules
uses: actions/cache@v5
with:
path: ~\Documents\PowerShell\Modules
key: ps-modules-${{ runner.os }}-v1
- name: Install Prerequisites
if: steps.cache-powershell-modules.outputs.cache-hit != 'true'
shell: pwsh
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
$modules = @('Pester','PSFramework','PSModuleDevelopment','PSScriptAnalyzer','psake')
foreach ($module in $modules) {
Write-Host "Installing $module..."
Install-Module -Name $module -Scope CurrentUser -Force -SkipPublisherCheck
}
- name: Validate
shell: pwsh
run: build\vsts-validate.ps1 -TestGeneral $false -TestFunctions $true
build-and-release:
name: Build and Release
runs-on: windows-latest
needs: [general-unit-tests, individual-unit-tests]
permissions:
contents: write
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Cache Powershell Modules
id: cache-powershell-modules
uses: actions/cache@v5
with:
path: ~\Documents\PowerShell\Modules
key: ps-modules-${{ runner.os }}-v1
- name: Install Prerequisites
if: steps.cache-powershell-modules.outputs.cache-hit != 'true'
shell: pwsh
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
$modules = @('Pester','PSFramework','PSModuleDevelopment','PSScriptAnalyzer','psake')
foreach ($module in $modules) {
Write-Host "Installing $module..."
Install-Module -Name $module -Scope CurrentUser -Force -SkipPublisherCheck
}
- name: Build
shell: pwsh
run: .\build\vsts-build.ps1 -ApiKey ${{ secrets.ApiKey }} -AutoVersion:$true -SkipPublish:$false
- name: Get version
shell: pwsh
run: |
$publishDir = Get-Item -Path publish
[version]$version = (Import-PowerShellDataFile -Path "$($publishDir.FullName)\PsLogicAppExtractor\PsLogicAppExtractor.psd1").ModuleVersion
$githubReleaseVersion = "$($version.Major).$($version.Minor).$($version.Build)"
"VERSION=$githubReleaseVersion" >> $env:GITHUB_ENV
- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
name: ${{ env.VERSION }}
tag_name: ${{ env.VERSION }}
draft: false
prerelease: true
generate_release_notes: true