diff --git a/.github/README.md b/.github/README.md
new file mode 100644
index 00000000..e820c8c6
--- /dev/null
+++ b/.github/README.md
@@ -0,0 +1,28 @@
+The workflows in this repository try to follow existing, basic samples with little customization.
+
+## main.yml
+We use a standard dotnet build/test/pack workflow
+https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
+
+- Build the solution using the dotnet cli
+ - Strong name the assemblies using a key stored in the repository
+ https://github.com/dotnet/runtime/blob/main/docs/project/strong-name-signing.md
+- Test the built libraries
+ - In a PR run, only local tests are run.
+ - In a CI run, live tests are run using a repository secret containing an OpenAI token
+ https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions
+- Package the built libraries
+- Publish the package to a GitHub NuGet registry
+ https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry
+- Publish a single build artifact containing test results and a nuget package
+
+## release.yml
+Releases are triggered by publishing a release in the GitHub repository. The release workflow will:
+
+- Build the solution using the dotnet cli
+ - Strong name the assemblies using a key stored in the repository
+- Test the built libraries
+ - Live tests are run using a repository secret containing an OpenAI token
+- Package the built libraries
+- Publish the package to public NuGet registry
+- Publish a single build artifact containing test results and a nuget package
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..4c201a68
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,60 @@
+name: Build and Test
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - main
+ pull_request:
+ types: [opened, reopened, synchronize]
+
+jobs:
+ build: # Test, pack and publish the Open AI nuget package as a build artifact
+ runs-on: ubuntu-latest
+ env:
+ version_suffix_args: ${{ format('--version-suffix="alpha.{0}"', github.run_number) }}
+ steps:
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 8.x
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Build and Pack
+ run: dotnet pack
+ --configuration Release
+ --output "${{github.workspace}}/artifacts/packages"
+ ${{ env.version_suffix_args }}
+
+ - name: Test
+ run: dotnet test
+ --configuration Release
+ --filter="TestCategory~${{ github.event_name == 'pull_request' && 'Offline' || 'Online' }}"
+ --logger "trx;LogFileName=${{github.workspace}}/artifacts/test-results/full.trx"
+ env:
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: build-artifacts
+ path: ${{github.workspace}}/artifacts
+
+ - name: NuGet Autenticate
+ if: github.event_name != 'pull_request'
+ run: dotnet nuget add source
+ "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
+ --name "github"
+ --username ${{ github.actor }}
+ --password ${{ secrets.GITHUB_TOKEN }}
+ --store-password-in-clear-text
+
+ - name: Publish
+ if: github.event_name != 'pull_request'
+ run: dotnet nuget push
+ ${{github.workspace}}/artifacts/packages/*.nupkg
+ --source "github"
+ --api-key ${{ secrets.GITHUB_TOKEN }}
+ --skip-duplicate
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..ff730350
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,53 @@
+name: Release package
+
+on:
+ release:
+ types: [published]
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ permissions:
+ packages: write
+ contents: write
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: '8.x' # SDK Version to use.
+
+ # Pack the client nuget package and include urls back to the repository and release tag
+ - name: Build and Pack
+ run: dotnet pack
+ --configuration Release
+ --output "${{github.workspace}}/artifacts/packages"
+ /p:RepositoryUrl="${{ github.repository }}"
+ /p:PackageProjectUrl="${{ github.repository }}/tree/${{ github.event.release.tag_name }}"
+
+ - name: Test
+ run: dotnet test
+ --configuration Release
+ --filter="TestCategory~Online"
+ --logger "trx;LogFileName=${{github.workspace}}/artifacts/test-results/full.trx"
+ env:
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+
+ # Append the nuget package to the github release that triggered this workflow
+ - name: Upload release asset
+ run: gh release upload ${{ github.event.release.tag_name }}
+ ${{github.workspace}}/artifacts/packages/*.nupkg
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: build-artifacts
+ path: ${{github.workspace}}/artifacts
+
+ # - name: Publish
+ # run: dotnet nuget push
+ # ${{github.workspace}}/artifacts/packages/*.nupkg
+ # --source https://api.nuget.org/v3/index.json
+ # --api-key ${{ secrets.NUGET_API_KEY }}
+ # --skip-duplicate
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
deleted file mode 100644
index 84bc0821..00000000
--- a/src/Directory.Build.props
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- 2.0.0
- beta.1
- true
- OpenAI.snk
-
-
\ No newline at end of file
diff --git a/src/OpenAI.csproj b/src/OpenAI.csproj
index d995dc2d..1fe93025 100644
--- a/src/OpenAI.csproj
+++ b/src/OpenAI.csproj
@@ -2,15 +2,40 @@
This is the OpenAI client library for developing .NET applications with rich experience.
SDK Code Generation OpenAI
- 2.0.0-beta.1
OpenAI
+
+ 2.0.0
+ beta.1
+
netstandard2.0;net6.0
latest
+
+
+ true
+ OpenAI.snk
+
+
true
- False
+
+
+ true
+
+
+ true
+ snupkg
+
+
+ true
+
+
+
+
+ true
+
+
-
\ No newline at end of file
+
diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs
deleted file mode 100644
index 226583c2..00000000
--- a/src/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo("Azure.AI.OpenAI")]