1
+ name : .NET Core
2
+ on :
3
+ # push:
4
+ # branches: [ master ]
5
+ # pull_request:
6
+ # branches: [ master ]
7
+ push :
8
+ pull_request :
9
+ release :
10
+ types :
11
+ - published
12
+ env :
13
+ # Disable sending usage data to Microsoft
14
+ DOTNET_CLI_TELEMETRY_OPTOUT : true
15
+ # Project name to pack and publish
16
+ PROJECT_NAME : ReBus.Serializer.XML
17
+ # GitHub Packages Feed settings
18
+ GITHUB_FEED : https://nuget.pkg.github.com/rebus-serializer-xml/
19
+ GITHUB_USER : rafek1241
20
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
21
+ # Official NuGet Feed settings
22
+ NUGET_FEED : https://api.nuget.org/v3/index.json
23
+ NUGET_KEY : ${{ secrets.NUGET_KEY }}
24
+ jobs :
25
+ build :
26
+ runs-on : ${{ matrix.os }}
27
+ strategy :
28
+ matrix :
29
+ # os: [ ubuntu-latest, windows-latest, macos-latest ]
30
+ os : [ ubuntu-latest ]
31
+ steps :
32
+ - name : Checkout
33
+ uses : actions/checkout@v2
34
+ with :
35
+ fetch-depth : 0
36
+ - name : Setup .NET Core
37
+ uses : actions/setup-dotnet@v1
38
+ with :
39
+ dotnet-version : ' 5.0.x'
40
+ - name : Install GitVersion
41
+ uses :
gittools/actions/gitversion/[email protected]
42
+ with :
43
+ versionSpec : ' 5.x'
44
+ - name : Determine Version
45
+ id : gitversion
46
+ uses :
gittools/actions/gitversion/[email protected]
47
+ - name : Restore
48
+ run : dotnet restore
49
+ - name : Build
50
+ run : dotnet build -c Release --no-restore
51
+ - name : Test
52
+ run : dotnet test -c Release
53
+ - name : Pack
54
+ run : dotnet pack -v normal -c Release --no-restore --no-build --include-symbols --include-source -p:PackageVersion=${{steps.gitversion.outputs.nuGetVersion}} src/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj
55
+ - name : Upload Artifact
56
+ uses : actions/upload-artifact@v2
57
+ with :
58
+ name : nupkg
59
+ path : ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg
60
+ prerelease :
61
+ needs : build
62
+ if : github.ref != 'refs/heads/master'
63
+ runs-on : ubuntu-latest
64
+ steps :
65
+ - name : Download Artifact
66
+ uses : actions/download-artifact@v1
67
+ with :
68
+ name : nupkg
69
+ - name : Push to GitHub Feed
70
+ run : |
71
+ for f in ./nupkg/*.nupkg
72
+ do
73
+ curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
74
+ done
75
+ deploy :
76
+ needs : build
77
+ if : github.event_name == 'release'
78
+ runs-on : ubuntu-latest
79
+ steps :
80
+ - uses : actions/checkout@v2
81
+ - name : Setup .NET Core
82
+ uses : actions/setup-dotnet@v1
83
+ with :
84
+ dotnet-version : ' 5.0.x'
85
+ - name : Create Release NuGet package
86
+ run : |
87
+ arrTag=(${GITHUB_REF//\// })
88
+ VERSION="${arrTag[2]}"
89
+ echo Version: $VERSION
90
+ VERSION="${VERSION//v}"
91
+ echo Clean Version: $VERSION
92
+ dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
93
+ - name : Push to GitHub Feed
94
+ run : |
95
+ for f in ./nupkg/*.nupkg
96
+ do
97
+ curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
98
+ done
99
+ - name : Push to NuGet Feed
100
+ run : dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY
0 commit comments