-
Notifications
You must be signed in to change notification settings - Fork 11
123 lines (103 loc) · 3.42 KB
/
workflow.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
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
121
122
123
name: Build,Format,Test,Publish
on:
push:
branches: [main]
pull_request:
branches: [ main ]
permissions:
id-token: write
contents: read
checks: write
packages: write
jobs:
build-dotnet:
runs-on: ubuntu-latest
# strategy:
# matrix:
# dotnet-version: [ '3.1.x', '6.0.x' ]
outputs:
clean_name: ${{steps.clean_branch_name.outputs.CLEAN_BRANCH_NAME}}
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Setup dotnet
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # v3.0.3
# with:
# dotnet-version: ${{ matrix.dotnet-version }}
# You can test your matrix by printing the current dotnet version
- name: Display dotnet version
run: dotnet --version
- name: Install dependencies
run: dotnet restore --locked-mode
- name: Build
run: >
dotnet build
--no-restore
--framework net6.0
--configuration Release
--verbosity minimal
- name: Check Format
run: dotnet format --verify-no-changes --no-restore
- name: Test with the dotnet CLI
run: >
dotnet test
--no-build
--no-restore
--framework net6.0
--configuration Release
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--
RunConfiguration.CollectSourceInformation=true
- id: clean_branch_name
name: Clean Branch Name
run: echo "CLEAN_BRANCH_NAME=${BRANCH_NAME/\//-}" >> "$GITHUB_OUTPUT"
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
build-framework:
runs-on: windows-latest
needs: build-dotnet
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# - name: Setup dotnet
# uses: setup msbuild?
- name: Display dotnet version
run: |
dotnet --version
dotnet --info
- name: Install dependencies
run: dotnet restore --locked-mode
- name: Build
# Don't specify a framework here so we build both .NET and .NET Framework so we can pack both
run: >
dotnet build
--no-restore
--configuration Release
--verbosity minimal
# Don't bother running formatting for this build
- name: Test with the dotnet CLI
# We will have already ran the tests on ubuntu, so only do .NET Framework ones here
run: >
dotnet test
--no-build
--no-restore
--framework net462
--configuration Release
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--
RunConfiguration.CollectSourceInformation=true
- name: Pack NuGet Packages
run: >
dotnet pack
--no-build
--configuration Release
--version-suffix "ci-${{ env.CLEAN_BRANCH_NAME }}-${{ github.run_id }}"
env:
CLEAN_BRANCH_NAME: ${{needs.build-dotnet.outputs.clean_name}}
- name: Publish NuGet Packages
run: >
dotnet nuget push **/*.nupkg
--source https://nuget.pkg.github.com/passwordless/index.json
--api-key ${{env.GITHUB_TOKEN}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}