-
Notifications
You must be signed in to change notification settings - Fork 8
68 lines (54 loc) · 1.62 KB
/
ci-cd.yml
File metadata and controls
68 lines (54 loc) · 1.62 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
name: CI/CD
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
release:
types: [ published ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Run Pester tests
shell: pwsh
run: |
Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser
Invoke-Pester -Path .\Tests\FindOpenFile.Tests.ps1 -Output Detailed
env:
BUILD_CONFIGURATION: Release
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: module
path: bin/Release/netstandard2.0/
publish:
needs: build
runs-on: windows-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Build Release
run: dotnet build --configuration Release
- name: Publish to PowerShell Gallery
shell: pwsh
env:
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
run: |
$modulePath = ".\bin\Release\netstandard2.0"
Rename-Item ".\bin\Release\netstandard2.0" -NewName "FindOpenFile"
$modulePath = ".\FindOpenFile"
Publish-Module -Path $modulePath -NuGetApiKey $env:PSGALLERY_API_KEY -Verbose