Skip to content

pipeline tests

pipeline tests #20

Workflow file for this run

# 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*.*.*'
pull_request:
branches: [ "master" ]
env:
VERSION: 1.0.0
jobs:
build:
runs-on: ubuntu-latest
environment: Dev
steps:
- uses: actions/checkout@v3
- name: Set Version Variable
if: github.ref_type == 'tag'
env:
TAG: ${{ github.ref_name }}
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Get Tags
id: tags
run: |
git fetch --tags
echo "Tags fetched"
- name: Get Latest Tag
id: latest-tag
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo latest_tag
- 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
if: github.ref_type == 'tag'
run: dotnet test --no-build -c Release --verbosity normal
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:PackageVersion=$VERSION
- name: Push
if: github.ref_type == 'tag'
run: dotnet nuget push nupkgs/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json