|
| 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 | + - 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 | + xml_value=$(xmllint --xpath "string(//Project/PropertyGroup/PackageReleaseNotes)" ./src/Ocelot.Administration.IdentityServer4.csproj) |
| 65 | + tag_name="${{ github.ref_name }}" |
| 66 | + echo Going to replace release notes tag in ($xml_value) -> ${{ github.ref_name }} |
| 67 | + echo "${xml_value/tag*/tag\/$tag_name}" |
| 68 | + xmlstarlet ed -L -u "//Project/PropertyGroup/PackageReleaseNotes" -v "${xml_value/tag*/tag\/$tag_name}" ./src/Ocelot.Administration.IdentityServer4.csproj |
| 69 | + xml_value=$(xmllint --xpath "string(//Project/PropertyGroup/PackageReleaseNotes)" ./src/Ocelot.Administration.IdentityServer4.csproj) |
| 70 | + echo Replaced PackageReleaseNotes: $xml_value |
| 71 | +
|
| 72 | + - name: Restore dependencies |
| 73 | + run: dotnet restore ./Ocelot.Administration.IdentityServer4.sln |
| 74 | + - name: Pack project |
| 75 | + run: dotnet pack ./src/Ocelot.Administration.IdentityServer4.csproj --configuration Release --output ./packages /p:ContinuousIntegrationBuild=true |
| 76 | + # - name: Publish to GitHub Packages |
| 77 | + # run: dotnet nuget push ./packages/*.nupkg --source "https://nuget.pkg.github.com/ThreeMammals/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |
| 78 | + # - name: Publish to NuGet |
| 79 | + # run: dotnet nuget push ./packages/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_API_KEY_2025 }} --skip-duplicate |
| 80 | + |
| 81 | + - name: GitHub Release |
| 82 | + uses: softprops/action-gh-release@v2 |
| 83 | + env: |
| 84 | + PACKAGE_VERSION: ${{ steps.ver.outputs.PkgVersion }} |
| 85 | + OCELOT_VERSION: ${{ steps.xml.outputs.OcelotRefVer }} |
| 86 | + IS4_VERSION: ${{ steps.xml.outputs.IdentityServer4RefVer }} |
| 87 | + with: |
| 88 | + tag_name: 0.0.2 # Name of a tag. defaults to github.ref_name |
| 89 | + body: | |
| 90 | + ## Version [${{ env.PACKAGE_VERSION }}](https://www.nuget.org/packages/Ocelot.Administration.IdentityServer4/${{ env.PACKAGE_VERSION }}) |
| 91 | + > For Ocelot release: [${{ env.OCELOT_VERSION }}](https://github.com/ThreeMammals/Ocelot/releases/tag/${{ env.OCELOT_VERSION }}) |
| 92 | + > Ocelot package: v[${{ env.OCELOT_VERSION }}](https://www.nuget.org/packages/Ocelot/${{ env.OCELOT_VERSION }}) |
| 93 | + > IdentityServer4 package: v[${{ env.IS4_VERSION }}](https://www.nuget.org/packages/IdentityServer4/${{ env.IS4_VERSION }}) |
| 94 | +
|
| 95 | + This release deprecates the package due to the deprecation of [IdentityServer4](https://www.nuget.org/packages/IdentityServer4). |
| 96 | + 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** |
| 97 | + files: | |
| 98 | + packages/*.*pkg |
| 99 | + draft: true #false |
| 100 | + prerelease: true #false |
| 101 | + - name: Release to Ocelot Repo |
| 102 | + uses: softprops/action-gh-release@v2 |
| 103 | + #if: github.ref_type == 'tag' |
| 104 | + env: |
| 105 | + PACKAGE_TAG: ${{ github.ref_name }} |
| 106 | + PACKAGE_VERSION: ${{ steps.ver.outputs.PkgVersion }} |
| 107 | + OCELOT_VERSION: ${{ steps.xml.outputs.OcelotRefVer }} |
| 108 | + with: |
| 109 | + repository: ThreeMammals/Ocelot |
| 110 | + token: ${{ secrets.OCELOT_EXTENSION_PACKAGE_RELEASE_TOKEN_0 }} |
| 111 | + body: | |
| 112 | + ## Ocelot.Administration.IdentityServer4 version [${{ env.PACKAGE_VERSION }}](https://www.nuget.org/packages/Ocelot.Administration.IdentityServer4/${{ env.PACKAGE_VERSION }}) |
| 113 | + > Ocelot release: [${{ env.OCELOT_VERSION }}](https://github.com/ThreeMammals/Ocelot/releases/tag/${{ env.OCELOT_VERSION }}) |
| 114 | + > Ocelot.Administration.IdentityServer4 release: [${{ env.PACKAGE_VERSION }}](https://github.com/ThreeMammals/Ocelot.Administration.IdentityServer4/releases/tag/${{ env.PACKAGE_TAG }}) |
| 115 | + files: | |
| 116 | + packages/*.*pkg |
| 117 | + draft: true #false |
| 118 | + prerelease: true #false |
0 commit comments