From c25a062f1dfe399248bdff7f51224d03ed6c4110 Mon Sep 17 00:00:00 2001 From: Patrick Hallisey Date: Fri, 15 Mar 2024 16:33:58 -0700 Subject: [PATCH] Add release workflow (#25) --- .github/workflows/main.yml | 1 - .github/workflows/release.yml | 64 +++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2d11478b2..521ae2598 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,6 @@ jobs: build: # Test, pack and publish the Open AI nuget package as a build artifact runs-on: ubuntu-latest env: - # if we're in a manually queued run, version_suffix_args: ${{ format('--version-suffix="alpha.{0}"', github.run_number) }} steps: - name: Setup .NET diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..f296f9c90 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,64 @@ +name: Release package + +on: + workflow_dispatch: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.x' # SDK Version to use. + + - name: Build + run: dotnet build + -c Release + working-directory: .dotnet + + - name: Test + run: dotnet test + --no-build + --configuration Release + --filter="TestCategory~Online" + --logger "trx;LogFileName=${{github.workspace}}/artifacts/test-results/full.trx" + env: + SECRET_VALUE: ${{ secrets.OPENAI_TOKEN }} + working-directory: .dotnet + + - name: Pack + run: dotnet pack + --no-build + --configuration Release + --output "${{github.workspace}}/artifacts/packages" + working-directory: .dotnet + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: build-artifacts + path: ${{github.workspace}}/artifacts + + - name: NuGet Autenticate + 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 + working-directory: .dotnet + + - name: Publish + run: dotnet nuget push + ${{github.workspace}}/artifacts/packages/*.nupkg + --source "github" + --api-key ${{ secrets.GITHUB_TOKEN }} + --skip-duplicate + working-directory: .dotnet +