Fix generation order, add manual builder

This commit is contained in:
crobibero 2021-04-21 11:13:50 -06:00
parent 4c89795831
commit 2994fa16e2
5 changed files with 56 additions and 7 deletions

View File

@ -0,0 +1,49 @@
name: Generate stable API
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./stable
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- uses: actions/checkout@v2
with:
ref: 'master'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- name: Restore packages
run: dotnet restore
- name: Get OpenApi version
id: apiversion
run: echo "::set-output name=number::$(curl -s https://api.jellyfin.org/openapi/jellyfin-openapi-stable.json | jq '.info.version')"
- name: Generate Api Client
run: dotnet build -c Release
- name: Check if generated client files were modified
id: diff
run: echo "::set-output name=count::$(git status -s | grep cs | grep -v csproj | wc -l)"
- name: Publish to nuget
if: ${{ steps.diff.outputs.count }} > 0
run: dotnet nuget push bin/Release/*.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Commit new changes to the repo
if: ${{ steps.diff.outputs.count }} > 0
run: |
git config --global user.email "packaging@jellyfin.org"
git config --global user.name "Jellyfin Packaging Team"
git pull
git add .
git commit -m "Update stable OpenAPI client" || echo
git push

View File

@ -47,7 +47,7 @@ jobs:
- name: Check if generated client files were modified
id: diff
run: echo "::set-output name=count::$(git status -s | grep g.cs | grep -v csproj | wc -l)"
run: echo "::set-output name=count::$(git status -s | grep cs | grep -v csproj | wc -l)"
- name: Publish to nuget
if: ${{ steps.diff.outputs.count }} > 0

View File

@ -47,7 +47,7 @@ jobs:
- name: Check if generated client files were modified
id: diff
run: echo "::set-output name=count::$(git status -s | grep g.cs | grep -v csproj | wc -l)"
run: echo "::set-output name=count::$(git status -s | grep cs | grep -v csproj | wc -l)"
- name: Publish to nuget
if: ${{ steps.diff.outputs.count }} > 0

View File

@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="GenerateSdkSourceCode">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>10.7.2</Version>
<Version>10.7.2.1</Version>
</PropertyGroup>
<PropertyGroup>
<PackageId>Jellyfin.Sdk</PackageId>
@ -27,7 +27,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<Target Name="GenerateSdkSourceCode" BeforeTargets="CoreCompile;PrepareResource">
<Target Name="GenerateSdkSourceCode">
<Exec Command="$(NSwagExe_Net50) run nswag.json" />
</Target>
</Project>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="GenerateSdkSourceCode">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@ -27,7 +27,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<Target Name="GenerateSdkSourceCode" BeforeTargets="CoreCompile;PrepareResource">
<Target Name="GenerateSdkSourceCode">
<Exec Command="$(NSwagExe_Net50) run nswag.json" />
</Target>
</Project>