Skip to content

Add workflows for build and release #5

Add workflows for build and release

Add workflows for build and release #5

Workflow file for this run

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
run: dotnet build
--configuration Release
${{ env.version_suffix_args }}
- name: Test
run: dotnet test
--no-build
--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: Pack
run: dotnet pack
--no-build
--configuration Release
--output "${{github.workspace}}/artifacts/packages"
${{ env.version_suffix_args }}
- 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