pipeline tests #23
This file contains 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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET | |
on: | |
push: | |
branches: [ "master" ] | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+-preview[0-9][0-9][0-9]" | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: Dev | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Verify commit exists in origin/master | |
run: | | |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
git branch --remote --contains | grep origin/master | |
- name: Set VERSION variable from tag | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore -c Release /p:Version=${VERSION} | |
- name: Test | |
run: dotnet test --no-build -c Release --verbosity normal /p:Version=${VERSION} | |
env: | |
OpenAI__Endpoint: ${{vars.OPENAI_ENDPOINT}} | |
OpenAI__Key: ${{secrets.OPENAI_KEY}} | |
OpenAI__AudioService__Endpoint: ${{vars.OPENAI_AUDIOSERVICE_ENDPOINT}} | |
OpenAI__AudioService__Key: ${{secrets.OPENAI_AUDIOSERVICE_KEY}} | |
OpenAI__ImageService__Endpoint: ${{vars.OPENAI_IMAGESERVICE_ENDPOINT}} | |
OpenAI__ImageService__Key: ${{secrets.OPENAI_IMAGESERVICE_KEY}} | |
OpenAI__TranslationService__Endpoint: ${{vars.OPENAI_TRANSLATIONSERVICE_ENDPOINT}} | |
OpenAI__TranslationService__Key: ${{secrets.OPENAI_TRANSLATIONSERVICE_KEY}} | |
- name: Pack | |
run: dotnet pack --output nupkgs --no-restore --no-build -c Release /p:Version=${VERSION} | |
- name: Push | |
run: dotnet nuget push nupkgs/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json | |