Skip to content

Commit 868dce2

Browse files
committed
Release Package workflow
1 parent a87f26d commit 868dce2

File tree

3 files changed

+125
-8
lines changed

3 files changed

+125
-8
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: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Releases non-beta versions, without 'beta*' suffix
2+
name: Release Package
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*.*.*"
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+
# Replace Version, PackageReleaseNotes in .csproj
44+
- name: Update XML in .csproj
45+
id: ver
46+
run: |
47+
echo Version: ${{ steps.xml.outputs.Version }}
48+
echo Ocelot Ref Ver: ${{ steps.xml.outputs.OcelotRefVer }}
49+
echo IdentityServer4 Ref Ver: ${{ steps.xml.outputs.IdentityServer4RefVer }}
50+
s_Version="${{ steps.xml.outputs.Version }}"
51+
if [[ "$s_Version" == *-* ]]; then
52+
echo Version contains '-'
53+
first_part=$(echo "$s_Version" | cut -d'-' -f1)
54+
echo First part: $first_part
55+
new_value=$first_part
56+
else
57+
new_value=$s_Version
58+
fi
59+
echo Going to replace version: from $s_Version to $new_value
60+
xmlstarlet ed -L -u "//Project/PropertyGroup/Version" -v "$new_value" ./src/Ocelot.Administration.IdentityServer4.csproj
61+
xml_value=$(xmllint --xpath "string(//Project/PropertyGroup/Version)" ./src/Ocelot.Administration.IdentityServer4.csproj)
62+
echo Replaced Version: $xml_value
63+
echo "PkgVersion=$xml_value" >> $GITHUB_OUTPUT
64+
65+
xml_value=$(xmllint --xpath "string(//Project/PropertyGroup/PackageReleaseNotes)" ./src/Ocelot.Administration.IdentityServer4.csproj)
66+
tag_name="${{ github.ref_name }}"
67+
echo Going to replace release notes tag: in $xml_value to ${{ github.ref_name }}
68+
echo "${xml_value/tag*/tag\/$tag_name}"
69+
xmlstarlet ed -L -u "//Project/PropertyGroup/PackageReleaseNotes" -v "${xml_value/tag*/tag\/$tag_name}" ./src/Ocelot.Administration.IdentityServer4.csproj
70+
xml_value=$(xmllint --xpath "string(//Project/PropertyGroup/PackageReleaseNotes)" ./src/Ocelot.Administration.IdentityServer4.csproj)
71+
echo Replaced PackageReleaseNotes: $xml_value
72+
73+
- name: Restore dependencies
74+
run: dotnet restore ./Ocelot.Administration.IdentityServer4.sln
75+
- name: Pack project
76+
run: dotnet pack ./src/Ocelot.Administration.IdentityServer4.csproj --configuration Release --output ./packages /p:ContinuousIntegrationBuild=true
77+
# - name: Publish to GitHub Packages
78+
# run: dotnet nuget push ./packages/*.nupkg --source "https://nuget.pkg.github.com/ThreeMammals/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
79+
# - name: Publish to NuGet
80+
# run: dotnet nuget push ./packages/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_API_KEY_2025 }} --skip-duplicate
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.2 # 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
102+
- name: Release to Ocelot Repo
103+
uses: softprops/action-gh-release@v2
104+
#if: github.ref_type == 'tag'
105+
env:
106+
PACKAGE_TAG: ${{ github.ref_name }}
107+
PACKAGE_VERSION: ${{ steps.ver.outputs.PkgVersion }}
108+
OCELOT_VERSION: ${{ steps.xml.outputs.OcelotRefVer }}
109+
with:
110+
repository: ThreeMammals/Ocelot
111+
token: ${{ secrets.OCELOT_EXTENSION_PACKAGE_RELEASE_TOKEN_0 }}
112+
body: |
113+
## Ocelot.Administration.IdentityServer4 version [${{ env.PACKAGE_VERSION }}](https://www.nuget.org/packages/Ocelot.Administration.IdentityServer4/${{ env.PACKAGE_VERSION }})
114+
> Ocelot release: [${{ env.OCELOT_VERSION }}](https://github.com/ThreeMammals/Ocelot/releases/tag/${{ env.OCELOT_VERSION }})
115+
> Ocelot.Administration.IdentityServer4 release: [${{ env.PACKAGE_VERSION }}](https://github.com/ThreeMammals/Ocelot.Administration.IdentityServer4/releases/tag/${{ env.PACKAGE_TAG }})
116+
files: |
117+
packages/*.*pkg
118+
draft: true #false
119+
prerelease: true #false

src/Ocelot.Administration.IdentityServer4.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
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>
15-
<PackageReleaseNotes>https://github.com/ThreeMammals/Ocelot.Administration.IdentityServer4/releases</PackageReleaseNotes>
15+
<PackageReleaseNotes>https://github.com/ThreeMammals/Ocelot.Administration.IdentityServer4/releases/tag/v24.0</PackageReleaseNotes>
1616
<PackageTags>Gateway;.NET;Ocelot;IdentityServer4</PackageTags>
1717
<PackageIcon>ocelot_icon.png</PackageIcon>
1818
<PackageReadmeFile>README.md</PackageReadmeFile>

0 commit comments

Comments
 (0)