Skip to content

Commit f6e9516

Browse files
chore: add release pipeline
1 parent 9936d83 commit f6e9516

File tree

2 files changed

+74
-17
lines changed

2 files changed

+74
-17
lines changed

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
on:
2+
push:
3+
tags:
4+
- "v[0-9]+.[0-9]+.[0-9]+"
5+
env:
6+
# Stop wasting time caching packages
7+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
8+
# Disable sending usage data to Microsoft
9+
DOTNET_CLI_TELEMETRY_OPTOUT: true
10+
11+
# MYSQL DB
12+
DB_MYSQL_DATABASE: test_sqlkata
13+
DB_MYSQL_USER: root
14+
DB_MYSQL_PASSWORD: "root"
15+
DB_MYSQL_HOST: localhost
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 15
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
- name: Verify commit exists in origin/main
26+
run: git branch --remote --contains | grep origin/main
27+
# - name: Extract release notes
28+
# run: |
29+
# 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
30+
- name: Set VERSION variable from tag
31+
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
32+
- name: Build
33+
run: dotnet build --configuration Release /p:Version=${VERSION}
34+
- name: Start MySql
35+
run: |
36+
sudo /etc/init.d/mysql start
37+
mysqladmin -u ${{ env.DB_MYSQL_USER }} -p${{ env.DB_MYSQL_PASSWORD }} password ''
38+
mysql -e 'CREATE DATABASE ${{ env.DB_MYSQL_DATABASE }};' -u${{ env.DB_MYSQL_USER }}
39+
mysql -e 'CREATE TABLE cars(id int primary key auto_increment);' -u${{ env.DB_MYSQL_USER }} ${{ env.DB_MYSQL_DATABASE }}
40+
mysql -e 'SHOW TABLES;' -u${{ env.DB_MYSQL_USER }} ${{ env.DB_MYSQL_DATABASE }}
41+
- name: Test
42+
run: dotnet test --configuration Release /p:Version=${VERSION} --no-build
43+
env:
44+
SQLKATA_MYSQL_HOST: ${{ env.DB_MYSQL_HOST }}
45+
SQLKATA_MYSQL_USER: ${{ env.DB_MYSQL_USER }}
46+
SQLKATA_MYSQL_DB: ${{ env.DB_MYSQL_DATABASE }}
47+
- name: Pack
48+
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .
49+
- name: Push
50+
run: dotnet nuget push *.${VERSION}.nupkg --source https://nuget.pkg.github.com/sqlkata/index.json --api-key ${GITHUB_TOKEN}
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>net8.0</TargetFrameworks>
4-
<OutputType>Library</OutputType>
5-
<IsPackable>false</IsPackable>
6-
<RootNamespace>SqlKata.Tests</RootNamespace>
7-
</PropertyGroup>
8-
<ItemGroup>
9-
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.8" />
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
11-
<PackageReference Include="MySql.Data" Version="8.0.30" />
12-
<PackageReference Include="xunit" Version="2.3.1" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
14-
</ItemGroup>
15-
<ItemGroup>
16-
<ProjectReference Include="..\QueryBuilder\QueryBuilder.csproj" />
17-
<ProjectReference Include="..\SqlKata.Execution\SqlKata.Execution.csproj" />
18-
</ItemGroup>
2+
<PropertyGroup>
3+
<TargetFrameworks>net8.0</TargetFrameworks>
4+
<OutputType>Library</OutputType>
5+
<IsPackable>false</IsPackable>
6+
<RootNamespace>SqlKata.Tests</RootNamespace>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.Data.Sqlite"
10+
Version="9.0.1" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk"
12+
Version="17.12.0" />
13+
<PackageReference Include="MySql.Data"
14+
Version="8.0.30" />
15+
<PackageReference Include="xunit"
16+
Version="2.9.3" />
17+
<PackageReference Include="xunit.runner.visualstudio"
18+
Version="3.0.1" />
19+
</ItemGroup>
20+
<ItemGroup>
21+
<ProjectReference Include="..\QueryBuilder\QueryBuilder.csproj" />
22+
<ProjectReference Include="..\SqlKata.Execution\SqlKata.Execution.csproj" />
23+
</ItemGroup>
1924
</Project>

0 commit comments

Comments
 (0)