1
+ name : Build, test and deploy
2
+
3
+ on :
4
+ push :
5
+ pull_request :
6
+
7
+ env :
8
+ # Stop wasting time caching packages
9
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : true
10
+ # Disable sending usage data to Microsoft
11
+ DOTNET_CLI_TELEMETRY_OPTOUT : true
12
+
13
+ # Official NuGet Feed settings
14
+ NUGET_FEED : https://api.nuget.org/v3/index.json
15
+
16
+ jobs :
17
+ build_test_deploy :
18
+ runs-on : ubuntu-20.04
19
+ defaults :
20
+ run :
21
+ working-directory : ./source
22
+
23
+ steps :
24
+ - name : Checkout
25
+ uses : actions/checkout@v2
26
+ with :
27
+ fetch-depth : 0
28
+
29
+ - name : Setup GitVersion
30
+ uses :
gittools/actions/gitversion/[email protected]
31
+ with :
32
+ versionSpec : ' 5.8.1'
33
+
34
+ - name : Determine Version
35
+ id : gitversion
36
+ uses :
gittools/actions/gitversion/[email protected]
37
+
38
+ - name : Setup .NET
39
+ uses : actions/setup-dotnet@v1
40
+ with :
41
+ dotnet-version : 6.0.x
42
+
43
+ - name : Restore dependencies
44
+ run : dotnet restore
45
+
46
+ - name : Build Test version
47
+ run : dotnet build --configuration Release --no-restore
48
+
49
+ - name : Run Tests
50
+ run : dotnet test --configuration Release --verbosity normal --collect:"XPlat Code Coverage" --settings MyPackage.Tests/coverlet.runsettings
51
+
52
+ - name : Build Release version
53
+ run : dotnet build --no-restore --configuration Release /p:AssemblyVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} /p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} /p:InformationalVersion=${{ steps.gitversion.outputs.Sha }}
54
+
55
+ - name : Pack
56
+ run : dotnet pack --no-build --output ./output --configuration Release /p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersionV2 }}
57
+
58
+ - name : Upload Package to job as artificat
59
+ uses : actions/upload-artifact@v2
60
+ with :
61
+ name : " Marten.AspNetCore.Identity-${{ steps.gitversion.outputs.nuGetVersionV2 }}"
62
+ path : ./output/*.nupkg
63
+
64
+ - name : Upload Package to release
65
+ if : contains(github.ref, 'main')
66
+ uses : svenstaro/upload-release-action@v1-release
67
+ with :
68
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
69
+ file_glob : true
70
+ file : ./output/*.nupkg
71
+ tag : " ${{ steps.gitversion.outputs.fullSemVer }}"
72
+ overwrite : true
73
+
74
+ - name : Upload Package to nuget
75
+ if : contains(github.ref, 'main')
76
+ run : dotnet nuget push ./output/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key ${{ secrets.NUGET_KEY }}
0 commit comments