diff --git a/.dotnet/nuget.config b/.dotnet/nuget.config
new file mode 100644
index 000000000..824446d51
--- /dev/null
+++ b/.dotnet/nuget.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/.dotnet/scripts/Update-Client.ps1 b/.dotnet/scripts/Update-Client.ps1
new file mode 100644
index 000000000..8832c2393
--- /dev/null
+++ b/.dotnet/scripts/Update-Client.ps1
@@ -0,0 +1,21 @@
+$repoRoot = Join-Path $PSScriptRoot .. .. -Resolve
+$dotnetFolder = Join-Path $repoRoot .dotnet
+
+function Invoke([scriptblock]$script) {
+ $scriptString = $script | Out-String
+ Write-Host "--------------------------------------------------------------------------------`n> $scriptString"
+ & $script
+}
+
+Push-Location $repoRoot
+try {
+ Invoke { npm ci }
+ Invoke { npm exec --no -- tsp compile main.tsp --emit @typespec/openapi3 }
+ Invoke { npm exec --no -- tsp compile main.tsp --emit @azure-tools/typespec-csharp --option @azure-tools/typespec-csharp.emitter-output-dir="$dotnetFolder" }
+ Invoke { .dotnet\scripts\Update-ClientModel.ps1 }
+ Invoke { .dotnet\scripts\ConvertTo-Internal.ps1 }
+ Invoke { .dotnet\scripts\Add-Customizations.ps1 }
+}
+finally {
+ Pop-Location
+}
diff --git a/.dotnet/src/Directory.Build.props b/.dotnet/src/Directory.Build.props
new file mode 100644
index 000000000..722190624
--- /dev/null
+++ b/.dotnet/src/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+ true
+ OpenAI.snk
+
+
\ No newline at end of file
diff --git a/.dotnet/src/OpenAI.snk b/.dotnet/src/OpenAI.snk
new file mode 100644
index 000000000..fa09b4dee
Binary files /dev/null and b/.dotnet/src/OpenAI.snk differ
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index bbe92ae53..67442cf69 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,5 +1,9 @@
name: Validate OpenAPI definition
on:
+ workflow_dispatch:
+ push:
+ branches:
+ - main
pull_request:
types: [opened, reopened, synchronize]
@@ -25,3 +29,27 @@ jobs:
with:
swagger-editor-url: http://localhost/
definition-file: openapi.yaml
+
+ # Test, pack and publish the Open AI nuget package as a build artifact
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 8.x
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+
+ - name: Pack
+ run: dotnet pack -c Release -o out
+ working-directory: .dotnet
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: package
+ path: out/*.nupkg
+ if: ${{ github.event_name != 'pull_request' }}