File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ # .github/workflows/dotnet.yml
2+ name : .NET CI
3+
4+ on :
5+ push :
6+ branches :
7+ - main
8+ pull_request :
9+ branches :
10+ - main
11+
12+ jobs :
13+ build :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v2
19+
20+ - name : Setup .NET
21+ uses : actions/setup-dotnet@v3
22+ with :
23+ dotnet-version : ' 7.x' # Specify the version or use 'latest' for the most recent
24+
25+ - name : Install dependencies
26+ run : dotnet restore
27+
28+ - name : Lint the code
29+ run : dotnet format --verify-no-changes
30+ continue-on-error : true
31+
32+ - name : Build the project
33+ run : dotnet build --no-restore --configuration Release
34+
35+ - name : Run unit tests
36+ run : dotnet test --no-build --configuration Release --verbosity normal
37+
38+ - name : Package the project
39+ run : dotnet pack --no-build --configuration Release -o ./artifacts
40+
41+ - name : Publish package to GitHub Packages
42+ if : github.ref == 'refs/heads/main' && success() # Publish only on successful builds of the main branch
43+ env :
44+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45+ run : dotnet nuget push ./artifacts/*.nupkg --source "github"
You can’t perform that action at this time.
0 commit comments