Skip to content

Commit

Permalink
chore: add release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad-moussawi committed Feb 1, 2025
1 parent 9936d83 commit f6e9516
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 17 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true

# MYSQL DB
DB_MYSQL_DATABASE: test_sqlkata
DB_MYSQL_USER: root
DB_MYSQL_PASSWORD: "root"
DB_MYSQL_HOST: localhost
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify commit exists in origin/main
run: git branch --remote --contains | grep origin/main
# - name: Extract release notes
# run: |
# git log --pretty=format:'%d %s' ${GITHUB_REF} | perl -pe 's| \(.*tag: v(\d+.\d+.\d+(-preview\d{3})?)(, .*?)*\)|\n## \1\n|g' > RELEASE-NOTES
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Build
run: dotnet build --configuration Release /p:Version=${VERSION}
- name: Start MySql
run: |
sudo /etc/init.d/mysql start
mysqladmin -u ${{ env.DB_MYSQL_USER }} -p${{ env.DB_MYSQL_PASSWORD }} password ''
mysql -e 'CREATE DATABASE ${{ env.DB_MYSQL_DATABASE }};' -u${{ env.DB_MYSQL_USER }}
mysql -e 'CREATE TABLE cars(id int primary key auto_increment);' -u${{ env.DB_MYSQL_USER }} ${{ env.DB_MYSQL_DATABASE }}
mysql -e 'SHOW TABLES;' -u${{ env.DB_MYSQL_USER }} ${{ env.DB_MYSQL_DATABASE }}
- name: Test
run: dotnet test --configuration Release /p:Version=${VERSION} --no-build
env:
SQLKATA_MYSQL_HOST: ${{ env.DB_MYSQL_HOST }}
SQLKATA_MYSQL_USER: ${{ env.DB_MYSQL_USER }}
SQLKATA_MYSQL_DB: ${{ env.DB_MYSQL_DATABASE }}
- name: Pack
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .
- name: Push
run: dotnet nuget push *.${VERSION}.nupkg --source https://nuget.pkg.github.com/sqlkata/index.json --api-key ${GITHUB_TOKEN}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39 changes: 22 additions & 17 deletions QueryBuilder.Tests/QueryBuilder.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Library</OutputType>
<IsPackable>false</IsPackable>
<RootNamespace>SqlKata.Tests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="MySql.Data" Version="8.0.30" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\QueryBuilder\QueryBuilder.csproj" />
<ProjectReference Include="..\SqlKata.Execution\SqlKata.Execution.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Library</OutputType>
<IsPackable>false</IsPackable>
<RootNamespace>SqlKata.Tests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite"
Version="9.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk"
Version="17.12.0" />
<PackageReference Include="MySql.Data"
Version="8.0.30" />
<PackageReference Include="xunit"
Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio"
Version="3.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\QueryBuilder\QueryBuilder.csproj" />
<ProjectReference Include="..\SqlKata.Execution\SqlKata.Execution.csproj" />
</ItemGroup>
</Project>

0 comments on commit f6e9516

Please sign in to comment.