forked from bterlson/openai-in-typespec
-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (63 loc) · 2.12 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
-c Release
${{ env.version_suffix_args }}
working-directory: .dotnet
- 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:
SECRET_VALUE: ${{ secrets.OPENAI_TOKEN }}
working-directory: .dotnet
- name: Pack
run: dotnet pack
--no-build
--configuration Release
--output "${{github.workspace}}/artifacts/packages"
${{ env.version_suffix_args }}
working-directory: .dotnet
- 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
working-directory: .dotnet
- 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
working-directory: .dotnet