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