Skip to content

Commit e80ccd0

Browse files
add release pipeline (microsoft#1989)
1 parent 2000646 commit e80ccd0

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/dotnet-release.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: dotnet-release
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches:
10+
- dotnet/release
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
jobs:
21+
build:
22+
name: Build and release
23+
runs-on: ubuntu-latest
24+
environment: dotnet
25+
defaults:
26+
run:
27+
working-directory: dotnet
28+
steps:
29+
- uses: actions/checkout@v3
30+
- name: Setup .NET
31+
uses: actions/setup-dotnet@v3
32+
with:
33+
global-json-file: dotnet/global.json
34+
- name: Restore dependencies
35+
run: |
36+
dotnet restore -bl
37+
- name: Build
38+
run: |
39+
echo "Build AutoGen"
40+
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
41+
- name: Unit Test
42+
run: dotnet test --no-build -bl --configuration Release
43+
env:
44+
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
45+
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
46+
AZURE_GPT_35_MODEL_ID: ${{ secrets.AZURE_GPT_35_MODEL_ID }}
47+
OEPNAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
48+
- name: Pack
49+
run: |
50+
echo "Create release build package"
51+
dotnet pack --no-build --configuration Release --output './output/release' -bl
52+
53+
echo "ls output directory"
54+
ls -R ./output
55+
- name: Publish package to Nuget
56+
run: |
57+
echo "Publish package to Nuget"
58+
echo "ls output directory"
59+
ls -R ./output/release
60+
dotnet nuget push --api-key AzureArtifacts ./output/release/*.nupkg --skip-duplicate --api-key ${{ secrets.AUTOGEN_NUGET_API_KEY }}
61+
- name: Tag commit
62+
run: |
63+
Write-Host "Tag commit"
64+
# version = eng/MetaInfo.props.Project.PropertyGroup.VersionPrefix
65+
$metaInfoContent = cat ./eng/MetaInfo.props
66+
$version = $metaInfoContent | Select-String -Pattern "<VersionPrefix>(.*)</VersionPrefix>" | ForEach-Object { $_.Matches.Groups[1].Value }
67+
git tag -a "$version" -m "AutoGen.Net release $version"
68+
git push origin --tags
69+
shell: pwsh

0 commit comments

Comments
 (0)