-
Notifications
You must be signed in to change notification settings - Fork 4
78 lines (75 loc) · 2.22 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
# This is a basic workflow to help you get started with Actions
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ published ]
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup PowerShell module cache
uses: actions/cache@v3
id: cacher
with:
path: "~/.local/share/powershell/Modules"
key: crescendo-1.1-preview-cache
- name: Install Crescendo
if: steps.cacher.outputs.cache-hit != 'true'
shell: pwsh
run: Install-Module Microsoft.PowerShell.Crescendo -AllowPrerelease -RequiredVersion 1.1.0-Preview01 -Force
- name: Build the module with Crescendo
shell: pwsh
run: ./build.ps1
- name: Bundle up module
uses: actions/upload-artifact@v3
with:
name: module
path: ./src/
Test:
needs: Build
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Download module
uses: actions/download-artifact@v3
with:
name: module
path: C:\Users\runneradmin\Documents\PowerShell\Modules\Foil\
- name: Test with Pester
run: |
Invoke-Pester -Configuration (New-PesterConfiguration -Hashtable @{
Run = @{
Exit = $true
}
Output = @{
Verbosity = 'Detailed'
}
})
- name: Upload Chocolatey logs
if: always()
uses: actions/upload-artifact@v3
with:
name: choco-logs
path: C:\ProgramData\chocolatey\logs\
Publish:
needs: Test
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
steps:
- name: Download module
uses: actions/download-artifact@v3
with:
name: module
path: '~/.local/share/powershell/Modules/Foil'
- name: Publish Module
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
shell: pwsh
run: Write-Output "Publishing..."; Publish-Module -Name Foil -NuGetApiKey $env:NUGET_KEY -Exclude @('foil.ps1')