Repository navigation
117 lines (110 loc) · 4.41 KB
/
Copy pathbuild.yml
File metadata and controls
117 lines (110 loc) · 4.41 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
name: Build and run unit tests
on:
push:
branches:
- main
pull_request:
branches:
- main
- release
release:
types:
- published
env:
SF_VERSION: '11.8.121.1'
permissions: {}
jobs:
pr-metrics:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
name: PR Metrics
runs-on: windows-latest
environment: github-app-main
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: App Token – Mint
id: app-token
uses: ./.github/actions/mint-github-app-token
with:
azure-client-id: ${{ vars.AZURE_CLIENT_ID }}
azure-tenant-id: ${{ vars.AZURE_TENANT_ID }}
azure-subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
permissions: '{"pull_requests":"write"}'
- name: PR Metrics
uses: microsoft/PR-Metrics@ac92804a3a0c8b711ca02dd9956ac6a7f2a1d2ca # v1.7.18
env:
PR_METRICS_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }}
build:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
os: [windows-latest] # [ubuntu-latest, windows-latest, macOS-latest]
configuration: [Release, Debug]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install .NET 10 SDK
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '10.0.x'
- name: Install SF SDK
shell: powershell
run: |
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -OutFile setup.exe -Uri https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabric.${env:SF_VERSION}.exe"
.\setup.exe /accepteula /force /quiet /SkipPSExecutionPolicy
- name: Restore NuGet packages
run: dotnet restore --configfile NuGet-GitHub.Config
- name: Build with dotnet
run: dotnet build --configuration ${{ matrix.configuration }} --no-restore
- name: Run Unit Tests
run: dotnet test --no-build --configuration ${{ matrix.configuration }} --no-restore
- name: Create NuGet packages
run: dotnet pack --no-build --configuration ${{ matrix.configuration }} --no-restore
publish:
if: github.event_name == 'release' && !github.event.release.prerelease && github.event.release.target_commitish == 'main'
name: Publish NuGet packages
needs: build
runs-on: windows-latest
permissions:
contents: read
packages: write
env:
IsReleaseBuild: true
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install .NET 10 SDK
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '10.0.x'
- name: Install SF SDK
shell: powershell
run: |
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -OutFile setup.exe -Uri https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabric.${env:SF_VERSION}.exe"
.\setup.exe /accepteula /force /quiet /SkipPSExecutionPolicy
- name: Restore NuGet packages
run: dotnet restore --configfile NuGet-GitHub.Config
- name: Build with dotnet
run: dotnet build --configuration Release --no-restore
- name: Create NuGet packages
run: dotnet pack --no-build --configuration Release --no-restore
- name: Add GitHub package source
run: dotnet nuget add source https://nuget.pkg.github.com/microsoft/index.json --name "github" --username NotUsed --password ${{ secrets.GITHUB_TOKEN }}
- name: Publish NuGet packages
run: dotnet nuget push nuget\*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate --no-symbols true