openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.0.0-beta.12

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/release.yml

105lines · modecode

1# This workflow is triggered by new releases and on a daily schedule.
2# It builds, unit tests, live tests and published the Open AI nuget package.
3# For daily runs, the package is published to the GitHub package registry.
4# For releases, the package is published to the NuGet package registry.
5name: Release package
6
7on:
8 release:
9 types: [published]
10 schedule:
11 # run every day at 00:00
12 - cron: '0 0 * * *'
13
14jobs:
15 build:
16 name: Build
17 runs-on: ubuntu-latest
18 environment: Live Testing
19 env:
20 version_suffix_args: ${{ github.event_name == 'schedule' && format('/p:VersionSuffix="alpha.{0}"', github.run_number) || '' }}
21 permissions:
22 packages: write
23 contents: write
24 steps:
25 - name: Setup .NET
26 uses: actions/setup-dotnet@v3
27 with:
28 dotnet-version: '8.x'
29
30 - name: Checkout code
31 uses: actions/checkout@v2
32
33 # Pack the client nuget package and include url back to the repository and release tag
34 - name: Build and Pack
35 run: dotnet pack
36 --configuration Release
37 --output "${{ github.workspace }}/artifacts/packages"
38 /p:PackageProjectUrl="${{ github.server_url }}/${{ github.repository }}/tree/${{ github.event.release.tag_name }}"
39 /p:PackageReleaseNotes="${{ github.server_url }}/${{ github.repository }}/blob/${{ github.event.release.tag_name }}/CHANGELOG.md"
40 ${{ env.version_suffix_args }}
41
42 - name: Unit Test
43 run: dotnet test
44 --configuration Release
45 --filter="TestCategory=Smoke&TestCategory!=Manual"
46 --logger "trx;LogFileName=${{ github.workspace }}/artifacts/test-results/smoke.trx"
47 ${{ env.version_suffix_args }}
48
49 - name: Run Live Tests
50 run: dotnet test ./tests/OpenAI.Tests.csproj
51 --configuration Release
52 --filter="TestCategory!=Smoke&TestCategory!=Images&TestCategory!=Uploads&TestCategory!=Moderations&TestCategory!=Manual"
53 --logger "trx;LogFilePrefix=live"
54 --results-directory ${{ github.workspace }}/artifacts/test-results
55 ${{ env.version_suffix_args }}
56 env:
57 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
58
59 - name: Upload artifact
60 uses: actions/upload-artifact@v4
61 if: ${{ !cancelled() }}
62 with:
63 name: build-artifacts
64 path: ${{ github.workspace }}/artifacts
65
66 deploy:
67 name: Publish Package
68 needs: build
69 runs-on: ubuntu-latest
70 steps:
71 - name: Checkout code
72 uses: actions/checkout@v2
73
74 - name: Download build artifacts
75 uses: actions/download-artifact@v4
76
77 - name: Upload release asset
78 if: github.event_name == 'release'
79 run: gh release upload ${{ github.event.release.tag_name }}
80 ${{ github.workspace }}/build-artifacts/packages/*.*nupkg
81 env:
82 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83
84 - name: NuGet authenticate
85 run: dotnet nuget add source
86 "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
87 --name "github"
88 --username ${{ github.actor }}
89 --password ${{ secrets.GITHUB_TOKEN }}
90 --store-password-in-clear-text
91
92 - name: Publish package to local feed
93 run: dotnet nuget push
94 ${{github.workspace}}/build-artifacts/packages/*.nupkg
95 --source "github"
96 --api-key ${{ secrets.GITHUB_TOKEN }}
97 --skip-duplicate
98
99 - name: Publish package to nuget.org
100 if: github.event_name == 'release'
101 run: dotnet nuget push
102 ${{github.workspace}}/build-artifacts/packages/*.nupkg
103 --source https://api.nuget.org/v3/index.json
104 --api-key ${{ secrets.NUGET_API_KEY }}
105 --skip-duplicate