Skip to content

Commit

Permalink
enable github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad-moussawi committed Mar 14, 2021
1 parent 36de3f4 commit 838f8ca
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 5 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: .NET Core
on:
push:
pull_request:
release:
types:
- published
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: SqlKata
# DOTNET_VERSION: 5.0.100
DOTNET_VERSION: 2.2.203
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/sqlkata/
GITHUB_USER: ahmad-moussawi
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Official NuGet Feed settings
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_KEY: ${{ secrets.NUGET_KEY }}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
run: dotnet test -c Release
- name: Pack QueryBuilder
if: matrix.os == 'ubuntu-latest'
run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=$GITHUB_RUN_ID QueryBuilder/QueryBuilder.csproj
- name: Pack SqlKata.Execution
if: matrix.os == 'ubuntu-latest'
run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=$GITHUB_RUN_ID SqlKata.Execution/SqlKata.Execution.csproj
- name: Upload QueryBuilder Artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ./QueryBuilder/bin/Release/*.nupkg
- name: Upload SqlKata.Execution Artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ./SqlKata.Execution/bin/Release/*.nupkg
prerelease:
needs: build
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v1
with:
name: nupkg
- name: Push to GitHub Feed
run: |
for f in ./nupkg/*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done
deploy:
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Create Release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION//v}"
echo Clean Version: $VERSION
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
- name: Push to GitHub Feed
run: |
for f in ./nupkg/*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done
- name: Push to NuGet Feed
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY
2 changes: 1 addition & 1 deletion QueryBuilder/QueryBuilder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Description>A powerful Dynamic Sql Query Builder supporting Sql Server, MySql, PostgreSql, Oracle and Firebird</Description>
<Authors>Ahmad Moussawi</Authors>
<Copyright>Copyright (c) 2017 Ahmad Moussawi</Copyright>
<TargetFrameworks>net45;netstandard1.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<RootNamespace>SqlKata</RootNamespace>
<AssemblyName>SqlKata</AssemblyName>
</PropertyGroup>
Expand Down
5 changes: 1 addition & 4 deletions SqlKata.Execution/SqlKata.Execution.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description>Adds the execution capabilities for SqlKata</Description>
<Authors>Ahmad Moussawi</Authors>
<Copyright>Copyright (c) 2017 Ahmad Moussawi</Copyright>
<TargetFrameworks>netstandard1.0;net45</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<RootNamespace>SqlKata</RootNamespace>
</PropertyGroup>
<ItemGroup>
Expand All @@ -16,7 +16,4 @@
<PackageReference Include="dapper" Version="1.50.5" />
<PackageReference Include="Humanizer.Core" Version="2.8.26" />
</ItemGroup>
<PropertyGroup>
<TargetFrameworks>netstandard1.3;net451</TargetFrameworks>
</PropertyGroup>
</Project>

0 comments on commit 838f8ca

Please sign in to comment.