-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (46 loc) · 1.82 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
name: ci
on:
push:
pull_request:
workflow_dispatch:
release:
types: [released]
jobs:
ci:
runs-on: windows-latest
permissions:
contents: write
env:
SOLUTION_NAME: NickJohn.WinUI.ObservableSettings.sln
PACKAGE_PROJECT_NAME: NickJohn.WinUI.ObservableSettings
TEST_PROJECT_NAME: NickJohn.WinUI.ObservableSettings.Test
CONFIGURATION: Release
PLATFORM: x64
steps:
- name: 📃 Create draft release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
with:
draft: true
generateReleaseNotes: true
- name: Checkout
uses: actions/checkout@v3
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Add VSTest to PATH
uses: darenm/[email protected]
- name: Restore dependencies
run: dotnet restore $env:SOLUTION_NAME
- name: Build solution
run: msbuild $env:SOLUTION_NAME /p:Configuration=${{ env.CONFIGURATION }} /p:Platform=${{ env.PLATFORM }}
- name: 🧪 Unit testing
run: vstest.console.exe test\${{ env.TEST_PROJECT_NAME }}\bin\${{ env.PLATFORM }}\${{ env.CONFIGURATION }}\*\${{ env.TEST_PROJECT_NAME }}.build.appxrecipe
- name: 🚀 Publish to Nuget
if: github.event_name == 'release' && github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
run: |
$packageFile = Get-ChildItem src\${{ env.PACKAGE_PROJECT_NAME }}\bin\${{ env.CONFIGURATION }}\${{ env.PACKAGE_PROJECT_NAME }}.*.nupkg
dotnet nuget push $packageFile --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json