Skip to content

Commit c4c3de4

Browse files
committed
pipeline
1 parent 7af3cda commit c4c3de4

3 files changed

Lines changed: 96 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Action to build and publish the project as a nuget package to github package registry
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
Version: ${{ steps.gitversion.outputs.SemVer }}
12+
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0 #fetch-depth is needed for GitVersion
18+
19+
#Install and calculate the new version with GitVersion
20+
- name: Install GitVersion
21+
uses: gittools/actions/gitversion/setup@v0.9.7
22+
with:
23+
versionSpec: 5.x
24+
- name: Determine Version
25+
uses: gittools/actions/gitversion/execute@v0.9.7
26+
id: gitversion # step id used as reference for output values
27+
- name: Display GitVersion outputs
28+
run: |
29+
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
30+
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
31+
32+
#Build/pack the project
33+
- name: Setup .NET
34+
uses: actions/setup-dotnet@v1
35+
with:
36+
dotnet-version: 7.0.x
37+
- name: Build and Pack NuGet package
38+
run: dotnet pack IdentityServer7.EntityFramework.csproj -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release
39+
- name: Upload NuGet package to GitHub
40+
uses: actions/upload-artifact@v2
41+
with:
42+
name: nugetPackage
43+
path: bin/Release/
44+
45+
release:
46+
runs-on: ubuntu-latest
47+
needs: build
48+
steps:
49+
#Push NuGet package to GitHub packages
50+
- name: Download nuget package artifact
51+
uses: actions/download-artifact@v1.0.0
52+
with:
53+
name: nugetPackage
54+
- name: Prep packages
55+
run: dotnet nuget add source --username fegomes --password ${{ secrets.NUGET_PACKAGE_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/fegomes/index.json"
56+
- name: Push package to GitHub packages
57+
if: needs.build.outputs.CommitsSinceVersionSource > 0 #Only release if there has been a commit/version change
58+
run: dotnet nuget push nugetPackage/*.nupkg --api-key ${{ secrets.NUGET_PACKAGE_TOKEN }} --source "github"
59+
60+
#Create release
61+
- name: Create Release
62+
if: 1 == 0 #needs.build.outputs.CommitsSinceVersionSource > 0 #Only release if there has been a commit/version change
63+
uses: actions/create-release@v1
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.NUGET_PACKAGE_TOKEN }}
66+
with:
67+
tag_name: ${{ needs.build.outputs.Version }}
68+
release_name: Release ${{ needs.build.outputs.Version }}
69+
- name: Create Release
70+
if: needs.build.outputs.CommitsSinceVersionSource > 0 #Only release if there has been a commit/version change
71+
uses: ncipollo/release-action@v1
72+
with:
73+
tag: ${{ needs.build.outputs.Version }}
74+
name: Release ${{ needs.build.outputs.Version }}
75+
artifacts: "nugetPackage/*"
76+
token: ${{ secrets.NUGET_PACKAGE_TOKEN }}

IdentityServer7.EntityFramework.csproj

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,28 @@
44
<TargetFramework>net7.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
8-
<PackageOutputPath>$(SolutionDir)$(Configuration)</PackageOutputPath>
7+
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
8+
<PackageOutputPath>$(OutDir)</PackageOutputPath>
9+
<PackageId>Braspin.$(AssemblyName)</PackageId>
10+
<Title>nuget.org</Title>
11+
<Company>Braspin</Company>
12+
<PackageProjectUrl>https://github.com/braspin/IdentityServer7.EntityFramework</PackageProjectUrl>
13+
<RepositoryUrl>https://github.com/braspin/IdentityServer7.EntityFramework</RepositoryUrl>
14+
<PackageReadmeFile>Readme.md</PackageReadmeFile>
15+
<RepositoryType>git</RepositoryType>
16+
<AssemblyVersion>1.0.0</AssemblyVersion>
17+
<FileVersion>1.0.0</FileVersion>
918
</PropertyGroup>
1019

1120
<ItemGroup>
12-
<ProjectReference Include="..\IdentityServer7.EntityFramework.Storage\IdentityServer7.EntityFramework.Storage.csproj" />
21+
<None Include="Readme.md">
22+
<Pack>True</Pack>
23+
<PackagePath>\</PackagePath>
24+
</None>
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<PackageReference Include="Braspin.IdentityServer7.EntityFramework.Storage" Version="0.1.0" />
1329
</ItemGroup>
1430

1531
</Project>

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# IdentityServer7.EntityFramework

0 commit comments

Comments
 (0)