Skip to content

Commit 7a399c6

Browse files
committed
Add GitHub action to publish packages on build.
1 parent 3be247e commit 7a399c6

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

.github/workflows/publish-package.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
paths-ignore:
8+
- 'docs/**'
9+
10+
env:
11+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
12+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
13+
14+
jobs:
15+
16+
publish:
17+
runs-on: 'windows-latest'
18+
19+
steps:
20+
- uses: actions/checkout@v1
21+
22+
- name: Set up .NET Core
23+
uses: actions/setup-dotnet@v1
24+
with:
25+
dotnet-version: 3.0.100
26+
27+
- name: Restore
28+
run: dotnet restore
29+
30+
- name: Build
31+
run: dotnet build --configuration Release
32+
33+
- name: Unit Tests
34+
run: dotnet test --configuration Release tests\MySqlConnector.Tests
35+
36+
- name: Pack
37+
run: dotnet pack --configuration Release --no-build --version-suffix $(Get-Date -Format "'preview'yyyyMMddHHmmss'+${{ github.sha }}'")
38+
39+
- name: Install NuGet
40+
run: choco install nuget.commandline
41+
42+
- name: Add NuGet source
43+
run: nuget sources Add -Name "GPR" -Source "https://nuget.pkg.github.com/mysql-net/index.json" -UserName bgrainger -Password ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Publish packages
46+
run: |
47+
$files = Get-ChildItem -Path src -Filter *.nupkg -Recurse
48+
foreach ($file in $files) {
49+
nuget push $file -Source GPR
50+
}

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1919
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2020
<GenerateDocumentationFile>true</GenerateDocumentationFile>
21-
<NoWarn>1591</NoWarn>
21+
<NoWarn>$(NoWarn);1591;NU5105</NoWarn>
2222
</PropertyGroup>
2323

2424
<ItemGroup>

0 commit comments

Comments
 (0)