Skip to content

Commit 6dca315

Browse files
committed
Publish Package workflow
1 parent 2abe1ad commit 6dca315

File tree

4 files changed

+101
-29
lines changed

4 files changed

+101
-29
lines changed

.config/dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-reportgenerator-globaltool": {
6+
"version": "5.4.7",
7+
"commands": [
8+
"reportgenerator"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

.github/workflows/dotnet.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Publishes beta-versions only
2+
name: Publish Package
3+
on:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check .NET 8
12+
id: check-dotnet8
13+
run: |
14+
DOTNET8_VERSION=$(dotnet --version)
15+
if [[ "$DOTNET8_VERSION" =~ ^8\.0\.[0-9]+$ ]]; then
16+
echo "dotnet8_installed=true" >> $GITHUB_ENV
17+
else
18+
echo "dotnet8_installed=false" >> $GITHUB_ENV
19+
fi
20+
- name: Setup .NET 8
21+
if: env.dotnet8_installed == 'false'
22+
uses: actions/setup-dotnet@v3
23+
with:
24+
dotnet-version: 8.0.x
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Restore
28+
run: dotnet restore ./Ocelot.Administration.IdentityServer4.sln -p:TargetFramework=net8.0
29+
- name: Build
30+
run: dotnet build --no-restore ./Ocelot.Administration.IdentityServer4.sln --framework net8.0
31+
- name: Unit tests
32+
run: dotnet test --no-restore --no-build ./unit/Ocelot.Administration.IdentityServer4.UnitTests.csproj --collect:"XPlat Code Coverage" --framework net8.0
33+
- name: Acceptance tests
34+
run: dotnet test --no-restore --no-build ./acceptance/Ocelot.Administration.IdentityServer4.AcceptanceTests.csproj --framework net8.0
35+
- name: Generate coverage report
36+
run: |
37+
echo "GITHUB_REF is ${{ env.GITHUB_REF }}"
38+
echo "GITHUB_REF_NAME is ${{ env.GITHUB_REF_NAME }}"
39+
echo "GITHUB_SHA is ${{ env.GITHUB_SHA }}"
40+
coverage_1st_folder=$(ls -d ./unit/TestResults/*/ | head -1)
41+
echo "Detected first folder : $coverage_1st_folder"
42+
coverage_file="${coverage_1st_folder%/}/coverage.cobertura.xml"
43+
echo "Detecting file $coverage_file ..."
44+
if [ -f "$coverage_file" ]; then
45+
echo "Coverage file exists."
46+
echo "COVERALLS_coverage_file_exists=true" >> $GITHUB_ENV
47+
echo "COVERALLS_coverage_file=$coverage_file" >> $GITHUB_ENV
48+
else
49+
echo "Coverage file DOES NOT exist!"
50+
echo "COVERALLS_coverage_file_exists=false" >> $GITHUB_ENV
51+
fi
52+
dotnet tool restore
53+
dotnet tool run reportgenerator
54+
55+
# build2:
56+
# runs-on: ubuntu-latest
57+
# permissions:
58+
# packages: write
59+
# contents: read
60+
# steps:
61+
# - name: Checkout repository
62+
# uses: actions/checkout@v4
63+
64+
# - name: Setup .NET
65+
# uses: actions/setup-dotnet@v4
66+
# with:
67+
# dotnet-version: |
68+
# 8.0.x
69+
# 9.0.x
70+
71+
# - name: .NET Info
72+
# run: dotnet --info
73+
74+
# - name: Restore dependencies
75+
# run: dotnet restore ./Ocelot.Administration.IdentityServer4.sln
76+
77+
# - name: Build project
78+
# run: dotnet build ./src/Ocelot.Testing.csproj --configuration Release --no-restore
79+
80+
# - name: Pack project
81+
# run: dotnet pack ./src/Ocelot.Testing.csproj --configuration Release --output ./packages
82+
83+
# - name: Publish to GitHub Packages
84+
# run: dotnet nuget push ./packages/*.nupkg --source "https://nuget.pkg.github.com/ThreeMammals/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
85+
86+
# - name: Publish to NuGet
87+
# run: dotnet nuget push ./packages/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_API_KEY_2025 }} --skip-duplicate

unit/Ocelot.Administration.IdentityServer4.UnitTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>
17+
<PackageReference Include="ReportGenerator.Core" Version="5.4.7" />
1718
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
1819
<PackageReference Include="Moq" Version="4.20.72" />
1920
<PackageReference Include="xunit" Version="2.9.3" />

0 commit comments

Comments
 (0)