Skip to content

Commit 3245105

Browse files
committed
Release Package workflow
1 parent a87f26d commit 3245105

File tree

3 files changed

+106
-7
lines changed

3 files changed

+106
-7
lines changed

.github/workflows/publish.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,11 @@ jobs:
224224
- name: Restore dependencies
225225
run: dotnet restore ./Ocelot.Administration.IdentityServer4.sln
226226

227-
# - name: Build project
228-
# run: dotnet build ./src/Ocelot.Administration.IdentityServer4.csproj --configuration Release --no-restore /p:ContinuousIntegrationBuild=true
229227
- name: Pack project
230228
run: dotnet pack ./src/Ocelot.Administration.IdentityServer4.csproj --configuration Release --output ./packages /p:ContinuousIntegrationBuild=true
231229

232-
- name: Publish to GitHub Packages
233-
run: dotnet nuget push ./packages/*.nupkg --source "https://nuget.pkg.github.com/ThreeMammals/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
230+
# - name: Publish to GitHub Packages
231+
# run: dotnet nuget push ./packages/*.nupkg --source "https://nuget.pkg.github.com/ThreeMammals/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
234232

235-
- name: Publish to NuGet
236-
run: dotnet nuget push ./packages/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_API_KEY_2025 }} --skip-duplicate
233+
# - name: Publish to NuGet
234+
# run: dotnet nuget push ./packages/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_API_KEY_2025 }} --skip-duplicate

.github/workflows/release.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Releases non-beta versions, without 'beta*' suffix
2+
name: Release Package
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
packages: write
14+
contents: write
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Setup .NET
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: |
22+
8.0.x
23+
9.0.x
24+
- name: .NET Info
25+
run: dotnet --info
26+
27+
- name: Install XML tools
28+
run: |
29+
sudo apt update
30+
sudo apt install libxml2-utils xmlstarlet
31+
- name: Read XML
32+
id: xml
33+
run: |
34+
xml_value=$(xmllint --xpath "string(//Project/PropertyGroup/Version)" ./src/Ocelot.Administration.IdentityServer4.csproj)
35+
echo Version: $xml_value
36+
echo "Version=$xml_value" >> $GITHUB_OUTPUT
37+
xml_value=$(xmllint --xpath "string((//Project/ItemGroup)[2]/PackageReference[@Include='Ocelot']/@Version)" ./src/Ocelot.Administration.IdentityServer4.csproj)
38+
echo Ocelot Ref Ver: $xml_value
39+
echo "OcelotRefVer=$xml_value" >> $GITHUB_OUTPUT
40+
xml_value=$(xmllint --xpath "string((//Project/ItemGroup)[2]/PackageReference[@Include='IdentityServer4']/@Version)" ./src/Ocelot.Administration.IdentityServer4.csproj)
41+
echo IdentityServer4 Ref Ver: $xml_value
42+
echo "IdentityServer4RefVer=$xml_value" >> $GITHUB_OUTPUT
43+
- name: Replace Version
44+
id: ver
45+
run: |
46+
echo Version: ${{ steps.xml.outputs.Version }}
47+
echo Ocelot Ref Ver: ${{ steps.xml.outputs.OcelotRefVer }}
48+
echo IdentityServer4 Ref Ver: ${{ steps.xml.outputs.IdentityServer4RefVer }}
49+
s_Version="${{ steps.xml.outputs.Version }}"
50+
if [[ "$s_Version" == *-* ]]; then
51+
echo Version contains '-'
52+
first_part=$(echo "$s_Version" | cut -d'-' -f1)
53+
echo First part: $first_part
54+
new_value=$first_part
55+
else
56+
new_value=$s_Version
57+
fi
58+
echo Going to replace version $s_Version -> $new_value
59+
xmlstarlet ed -L -u "//Project/PropertyGroup/Version" -v "$new_value" ./src/Ocelot.Administration.IdentityServer4.csproj
60+
xml_value=$(xmllint --xpath "string(//Project/PropertyGroup/Version)" ./src/Ocelot.Administration.IdentityServer4.csproj)
61+
echo Replaced Version: $xml_value
62+
echo "PkgVersion=$xml_value" >> $GITHUB_OUTPUT
63+
64+
- name: Restore dependencies
65+
run: dotnet restore ./Ocelot.Administration.IdentityServer4.sln
66+
- name: Pack project
67+
run: dotnet pack ./src/Ocelot.Administration.IdentityServer4.csproj --configuration Release --output ./packages /p:ContinuousIntegrationBuild=true
68+
# - name: Publish to GitHub Packages
69+
# run: dotnet nuget push ./packages/*.nupkg --source "https://nuget.pkg.github.com/ThreeMammals/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
70+
# - name: Publish to NuGet
71+
# run: dotnet nuget push ./packages/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_API_KEY_2025 }} --skip-duplicate
72+
73+
- name: Find assets
74+
id: assets
75+
run: |
76+
echo "ASSETS=$(find packages/*.* -print | tr '\n' ' ')" >> $GITHUB_OUTPUT
77+
echo "ASSETS=$(find packages/ -name '*.*pkg' -printf '%f\n')"
78+
- name: Use files in another step
79+
run: |
80+
echo "Files found: ${{ steps.assets.outputs.ASSETS }}"
81+
82+
- name: GitHub Release
83+
uses: softprops/action-gh-release@v2
84+
env:
85+
PACKAGE_VERSION: ${{ steps.ver.outputs.PkgVersion }}
86+
OCELOT_VERSION: ${{ steps.xml.outputs.OcelotRefVer }}
87+
IS4_VERSION: ${{ steps.xml.outputs.IdentityServer4RefVer }}
88+
with:
89+
tag_name: 0.0.1 # Name of a tag. defaults to github.ref_name
90+
body: |
91+
## Version [${{ env.PACKAGE_VERSION }}](https://www.nuget.org/packages/Ocelot.Administration.IdentityServer4/${{ env.PACKAGE_VERSION }})
92+
> For Ocelot release: [${{ env.OCELOT_VERSION }}](https://github.com/ThreeMammals/Ocelot/releases/tag/${{ env.OCELOT_VERSION }})
93+
> Ocelot package: v[${{ env.OCELOT_VERSION }}](https://www.nuget.org/packages/Ocelot/${{ env.OCELOT_VERSION }})
94+
> IdentityServer4 package: v[${{ env.IS4_VERSION }}](https://www.nuget.org/packages/IdentityServer4/${{ env.IS4_VERSION }})
95+
96+
This release deprecates the package due to the deprecation of [IdentityServer4](https://www.nuget.org/packages/IdentityServer4).
97+
For more details, see Ocelot [Releases](https://github.com/ThreeMammals/Ocelot/releases) → [${{ env.OCELOT_VERSION }}](https://www.nuget.org/packages/Ocelot/${{ env.OCELOT_VERSION }}) → **What's Updated?** → **Administration**
98+
files: |
99+
packages/*.*pkg
100+
draft: true #false
101+
prerelease: true #false

src/Ocelot.Administration.IdentityServer4.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<IncludeSymbols>True</IncludeSymbols>
1010
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1111
<!--Package properties-->
12-
<Version>24.0.0-beta.5</Version>
12+
<Version>24.0.0-beta.6</Version>
1313
<PackageId>Ocelot.Administration.IdentityServer4</PackageId>
1414
<PackageDescription>Provides Ocelot extensions to use the Administration API and IdentityServer4 dependencies that come with it</PackageDescription>
1515
<PackageReleaseNotes>https://github.com/ThreeMammals/Ocelot.Administration.IdentityServer4/releases</PackageReleaseNotes>

0 commit comments

Comments
 (0)