Skip to content

Commit 95b4337

Browse files
authored
Merge pull request #1 from rafek1241/cicd-definition
Add continous integration & deployment for nuget package
2 parents af80721 + 4d582c6 commit 95b4337

File tree

4 files changed

+125
-0
lines changed

4 files changed

+125
-0
lines changed

.github/workflows/dotnet.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: .NET Core
2+
on:
3+
# push:
4+
# branches: [ master ]
5+
# pull_request:
6+
# branches: [ master ]
7+
push:
8+
pull_request:
9+
release:
10+
types:
11+
- published
12+
env:
13+
# Disable sending usage data to Microsoft
14+
DOTNET_CLI_TELEMETRY_OPTOUT: true
15+
# Project name to pack and publish
16+
PROJECT_NAME: ReBus.Serializer.XML
17+
# GitHub Packages Feed settings
18+
GITHUB_FEED: https://nuget.pkg.github.com/rebus-serializer-xml/
19+
GITHUB_USER: rafek1241
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
# Official NuGet Feed settings
22+
NUGET_FEED: https://api.nuget.org/v3/index.json
23+
NUGET_KEY: ${{ secrets.NUGET_KEY }}
24+
jobs:
25+
build:
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
matrix:
29+
# os: [ ubuntu-latest, windows-latest, macos-latest ]
30+
os: [ ubuntu-latest ]
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
with:
35+
fetch-depth: 0
36+
- name: Setup .NET Core
37+
uses: actions/setup-dotnet@v1
38+
with:
39+
dotnet-version: '5.0.x'
40+
- name: Install GitVersion
41+
uses: gittools/actions/gitversion/[email protected]
42+
with:
43+
versionSpec: '5.x'
44+
- name: Determine Version
45+
id: gitversion
46+
uses: gittools/actions/gitversion/[email protected]
47+
- name: Restore
48+
run: dotnet restore
49+
- name: Build
50+
run: dotnet build -c Release --no-restore
51+
- name: Test
52+
run: dotnet test -c Release
53+
- name: Pack
54+
run: dotnet pack -v normal -c Release --no-restore --no-build --include-symbols --include-source -p:PackageVersion=${{steps.gitversion.outputs.nuGetVersion}} src/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj
55+
- name: Upload Artifact
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: nupkg
59+
path: ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg
60+
prerelease:
61+
needs: build
62+
if: github.ref != 'refs/heads/master'
63+
runs-on: ubuntu-latest
64+
steps:
65+
- name: Download Artifact
66+
uses: actions/download-artifact@v1
67+
with:
68+
name: nupkg
69+
- name: Push to GitHub Feed
70+
run: |
71+
for f in ./nupkg/*.nupkg
72+
do
73+
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
74+
done
75+
deploy:
76+
needs: build
77+
if: github.event_name == 'release'
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v2
81+
- name: Setup .NET Core
82+
uses: actions/setup-dotnet@v1
83+
with:
84+
dotnet-version: '5.0.x'
85+
- name: Create Release NuGet package
86+
run: |
87+
arrTag=(${GITHUB_REF//\// })
88+
VERSION="${arrTag[2]}"
89+
echo Version: $VERSION
90+
VERSION="${VERSION//v}"
91+
echo Clean Version: $VERSION
92+
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
93+
- name: Push to GitHub Feed
94+
run: |
95+
for f in ./nupkg/*.nupkg
96+
do
97+
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
98+
done
99+
- name: Push to NuGet Feed
100+
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY

NuGet.config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
6+
</packageSources>
7+
</configuration>

logo-200x200.png

34.2 KB
Loading

src/ReBus.Serializer.XML/ReBus.Serializer.XML.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,26 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
55
<LangVersion>default</LangVersion>
6+
7+
<!-- NuGet settings -->
8+
<PackageId>Rebus.Serializer.XML</PackageId>
9+
<PackageDescription>Provides an XML serializer for Rebus library</PackageDescription>
10+
<PackageTags>rebus xml-serialization serialization xml</PackageTags>
11+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
12+
<PackageIcon>logo-200x200.png</PackageIcon>
13+
<RepositoryType>git</RepositoryType>
14+
<Authors>rafek1241</Authors>
15+
<Company>rafek1241</Company>
16+
<RepositoryUrl>https://github.com/rafek1241/ReBus.Serializer.XML/</RepositoryUrl>
617
</PropertyGroup>
718

19+
<ItemGroup>
20+
<None Include="../../logo-200x200.png">
21+
<Pack>true</Pack>
22+
<PackagePath>$(PackageIconUrl)</PackagePath>
23+
</None>
24+
</ItemGroup>
25+
826
<ItemGroup>
927
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
1028
<PackageReference Include="Rebus" Version="6.5.5" />

0 commit comments

Comments
 (0)