1
+ name : .NET Core
2
+ on :
3
+ push :
4
+ branches :
5
+ - develop
6
+ pull_request :
7
+ release :
8
+ types :
9
+ - published
10
+ env :
11
+ # Stop wasting time caching packages
12
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : true
13
+ # Disable sending usage data to Microsoft
14
+ DOTNET_CLI_TELEMETRY_OPTOUT : true
15
+ # Project name to pack and publish
16
+ PROJECT_NAME : Synercoding.FileFormats.Pdf
17
+ # GitHub Packages Feed settings
18
+ GITHUB_FEED : https://nuget.pkg.github.com/synercoder/index.json
19
+ GITHUB_USER : synercoder
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
+ steps :
31
+ - name : Checkout
32
+ uses : actions/checkout@v2
33
+ - name : Setup .NET Core
34
+ uses : actions/setup-dotnet@v1
35
+ with :
36
+ dotnet-version : 3.1.x
37
+ - name : Restore
38
+ run : dotnet restore
39
+ - name : Build
40
+ run : dotnet build -c Release --no-restore
41
+ - name : Test
42
+ run : dotnet test -c Release
43
+ - name : Pack
44
+ if : matrix.os == 'ubuntu-latest'
45
+ run : dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:SymbolPackageFormat=snupkg -p:PackageVersion=$GITHUB_RUN_ID src/$PROJECT_NAME/$PROJECT_NAME.*proj
46
+ - name : Upload Artifact
47
+ if : matrix.os == 'ubuntu-latest'
48
+ uses : actions/upload-artifact@v2
49
+ with :
50
+ name : nupkg
51
+ path : ./artifacts/pkg/Release/${{ env.PROJECT_NAME }}.*.nupkg
52
+ prerelease :
53
+ needs : build
54
+ if : github.ref == 'refs/heads/develop'
55
+ runs-on : ubuntu-latest
56
+ steps :
57
+ - name : Download Artifact
58
+ uses : actions/download-artifact@v1
59
+ with :
60
+ name : nupkg
61
+ - name : Push to GitHub Feed
62
+ run : |
63
+ for f in ./nupkg/*.nupkg
64
+ do
65
+ curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
66
+ done
67
+ deploy :
68
+ needs : build
69
+ if : github.event_name == 'release'
70
+ runs-on : ubuntu-latest
71
+ steps :
72
+ - uses : actions/checkout@v2
73
+ - name : Setup .NET Core
74
+ uses : actions/setup-dotnet@v1
75
+ with :
76
+ dotnet-version : 3.1.x
77
+ - name : Create Release NuGet package
78
+ run : |
79
+ arrTag=(${GITHUB_REF//\// })
80
+ VERSION="${arrTag[2]}"
81
+ echo Version: $VERSION
82
+ VERSION="${VERSION//v}"
83
+ echo Clean Version: $VERSION
84
+ dotnet pack -v normal -c Release --include-symbols --include-source -p:SymbolPackageFormat=snupkg -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
85
+ - name : Push to GitHub Feed
86
+ run : |
87
+ for f in ./nupkg/*.nupkg
88
+ do
89
+ curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
90
+ done
91
+ - name : Push to NuGet Feed
92
+ if : ${{ env.NUGET_FEED }} != ''
93
+ run : dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY
0 commit comments