Create releases #158
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create releases | |
| on: | |
| schedule: | |
| - cron: '0 5 * * *' # every day at 5am UTC | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| name: release | |
| if: github.ref == 'refs/heads/main' && github.repository == 'anthropics/anthropic-sdk-csharp' | |
| runs-on: ubuntu-latest | |
| environment: production-release | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: stainless-api/trigger-release-please@v1 | |
| id: release | |
| with: | |
| repo: ${{ github.event.repository.full_name }} | |
| stainless-api-key: ${{ secrets.STAINLESS_API_KEY }} | |
| - name: Set up .NET | |
| if: ${{ steps.release.outputs.releases_created }} | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Build and pack | |
| if: ${{ steps.release.outputs.releases_created }} | |
| run: dotnet pack | |
| --configuration Release | |
| --output "${{github.workspace}}/artifacts/packages" | |
| - name: Publish package to nuget.org | |
| if: ${{ steps.release.outputs.releases_created }} | |
| run: dotnet nuget push | |
| $(find ${{ github.workspace }}/artifacts/packages/*.nupkg ! -name "*.symbols.nupkg") | |
| --source https://api.nuget.org/v3/index.json | |
| --api-key $NUGET_API_KEY | |
| env: | |
| NUGET_API_KEY: ${{ secrets.ANTHROPIC_NUGET_API_KEY || secrets.NUGET_API_KEY }} |