Skip to content

Commit b82f916

Browse files
authored
Automatically push nuget packages when creating a tag
The github actions workflow has been modified to automatically push nuget packages to nuget.org. Also the debug symbols are being provided to make it easier for user to debug if something is not working as expected. Closes #3
1 parent 46d9a3e commit b82f916

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

.github/workflows/dotnetcore.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,54 @@ on: [push]
55
jobs:
66
build:
77
runs-on: ubuntu-latest
8+
if: github.event_name == 'push'
89
steps:
910
- name: Dump GitHub context
1011
env:
1112
GITHUB_CONTEXT: ${{ toJson(github) }}
1213
run: echo "$GITHUB_CONTEXT"
1314
- name: Checkout
14-
uses: actions/checkout@v1
15+
uses: actions/checkout@v2
16+
- name: Fetch all history for all tags and branches
17+
run: git fetch --prune --unshallow
18+
- name: Install GitVersion
19+
uses: gittools/actions/gitversion/[email protected]
20+
with:
21+
versionSpec: '5.1.x'
22+
- name: Use GitVersion
23+
id: gitversion # step id used as reference for output values
24+
uses: gittools/actions/gitversion/[email protected]
1525
- name: Setup .NET Core
1626
uses: actions/setup-dotnet@v1
1727
with:
1828
dotnet-version: 3.1.101
19-
- name: Build with dotnet
20-
run: dotnet build --configuration Release
29+
- name: restore
30+
run: dotnet restore
31+
- name: build
32+
run: dotnet build --configuration Release --no-restore -property:Version=${{ steps.gitversion.outputs.semVer }}
2133
- name: Test with dotnet
2234
run: dotnet test --configuration Release --no-build
35+
- name: Pack
36+
run: dotnet pack --output ./artifacts --configuration Release --no-build -property:Version=${{ steps.gitversion.outputs.semVer }}
37+
- uses: actions/upload-artifact@v1
38+
with:
39+
name: artifacts
40+
path: ./artifacts
2341

24-
pack:
42+
publish:
2543
runs-on: ubuntu-latest
2644
needs: build
27-
if: github.event_name == 'push'
45+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
2846
steps:
2947
- name: Checkout
3048
uses: actions/checkout@v1
3149
- name: Setup .NET Core
3250
uses: actions/setup-dotnet@v1
3351
with:
3452
dotnet-version: 3.1.101
35-
- name: Pack
36-
run: dotnet pack --output ./artifacts --configuration Release
37-
- uses: actions/upload-artifact@v1
53+
- uses: actions/download-artifact@v1
3854
with:
3955
name: artifacts
4056
path: ./artifacts
57+
- name: Publish packages
58+
run: dotnet nuget push ./artifacts/**.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_TOKEN}}

src/HttpClientTestHelpers/HttpClientTestHelpers.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<LangVersion>8.0</LangVersion>
66
<Nullable>enable</Nullable>
77
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
8+
<IncludeSymbols>true</IncludeSymbols>
9+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
810
<Version>0.0.1</Version>
911
<Authors>David Perfors</Authors>
1012
<Product />

0 commit comments

Comments
 (0)