Skip to content

Commit 47633a3

Browse files
enable github actions
1 parent 36de3f4 commit 47633a3

File tree

3 files changed

+103
-5
lines changed

3 files changed

+103
-5
lines changed

.github/workflows/build.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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

QueryBuilder/QueryBuilder.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Description>A powerful Dynamic Sql Query Builder supporting Sql Server, MySql, PostgreSql, Oracle and Firebird</Description>
88
<Authors>Ahmad Moussawi</Authors>
99
<Copyright>Copyright (c) 2017 Ahmad Moussawi</Copyright>
10-
<TargetFrameworks>net45;netstandard1.1</TargetFrameworks>
10+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
1111
<RootNamespace>SqlKata</RootNamespace>
1212
<AssemblyName>SqlKata</AssemblyName>
1313
</PropertyGroup>

SqlKata.Execution/SqlKata.Execution.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Description>Adds the execution capabilities for SqlKata</Description>
77
<Authors>Ahmad Moussawi</Authors>
88
<Copyright>Copyright (c) 2017 Ahmad Moussawi</Copyright>
9-
<TargetFrameworks>netstandard1.0;net45</TargetFrameworks>
9+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
1010
<RootNamespace>SqlKata</RootNamespace>
1111
</PropertyGroup>
1212
<ItemGroup>
@@ -16,7 +16,4 @@
1616
<PackageReference Include="dapper" Version="1.50.5" />
1717
<PackageReference Include="Humanizer.Core" Version="2.8.26" />
1818
</ItemGroup>
19-
<PropertyGroup>
20-
<TargetFrameworks>netstandard1.3;net451</TargetFrameworks>
21-
</PropertyGroup>
2219
</Project>

0 commit comments

Comments
 (0)