openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
.github/workflows/release.yml
52lines · modecode
| 1 | name: Release package |
| 2 | |
| 3 | on: |
| 4 | release: |
| 5 | types: [published] |
| 6 | |
| 7 | jobs: |
| 8 | deploy: |
| 9 | runs-on: ubuntu-latest |
| 10 | permissions: |
| 11 | packages: write |
| 12 | contents: write |
| 13 | steps: |
| 14 | - uses: actions/checkout@v4 |
| 15 | - uses: actions/setup-dotnet@v3 |
| 16 | with: |
| 17 | dotnet-version: '8.x' # SDK Version to use. |
| 18 | |
| 19 | # Pack the client nuget package and include url back to the repository and release tag |
| 20 | - name: Build and Pack |
| 21 | run: dotnet pack |
| 22 | --configuration Release |
| 23 | --output "${{github.workspace}}/artifacts/packages" |
| 24 | /p:PackageProjectUrl="${{ github.server_url }}/${{ github.repository }}/tree/${{ github.event.release.tag_name }}" |
| 25 | |
| 26 | - name: Test |
| 27 | run: dotnet test |
| 28 | --configuration Release |
| 29 | --filter="TestCategory~Online" |
| 30 | --logger "trx;LogFileName=${{github.workspace}}/artifacts/test-results/full.trx" |
| 31 | env: |
| 32 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 33 | |
| 34 | # Append the nuget package to the github release that triggered this workflow |
| 35 | - name: Upload release asset |
| 36 | run: gh release upload ${{ github.event.release.tag_name }} |
| 37 | ${{github.workspace}}/artifacts/packages/*.*nupkg |
| 38 | env: |
| 39 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | |
| 41 | - name: Upload artifact |
| 42 | uses: actions/upload-artifact@v2 |
| 43 | with: |
| 44 | name: build-artifacts |
| 45 | path: ${{github.workspace}}/artifacts |
| 46 | |
| 47 | - name: Publish |
| 48 | run: dotnet nuget push |
| 49 | ${{github.workspace}}/artifacts/packages/*.*nupkg |
| 50 | --source https://api.nuget.org/v3/index.json |
| 51 | --api-key ${{ secrets.NUGET_API_KEY }} |
| 52 | --skip-duplicate |
| 53 | |