Automate publishing for C# (#207)

This commit is contained in:
Alexey 2023-03-16 20:59:48 +03:00 committed by GitHub
parent 903a13fb98
commit 23d92e5c12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -11,7 +11,7 @@ on:
branches: branches:
- main - main
env: env:
binding_build_number_based_version: 0.1.1.${{ github.run_number }} binding_build_number_based_version: 0.1.2.${{ github.run_number }}
jobs: jobs:
build-ckzg: build-ckzg:
@ -94,9 +94,12 @@ jobs:
- name: Test - name: Test
run: cd bindings/csharp && dotnet test --configuration Release --no-restore run: cd bindings/csharp && dotnet test --configuration Release --no-restore
- name: Build - name: Build
run: cd bindings/csharp && dotnet build -p:Version=${{ inputs.version || env.binding_build_number_based_version }} --configuration Release --no-restore run: cd bindings/csharp && dotnet pack -p:Version=${{ inputs.version || env.binding_build_number_based_version }} --configuration Release --no-restore --output nupkgs
- name: Upload package - name: Upload package
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: Ckzg.Bindings-${{ inputs.version || env.binding_build_number_based_version }} name: Ckzg.Bindings-${{ inputs.version || env.binding_build_number_based_version }}
path: bindings/csharp/build/Ckzg.Bindings.*.nupkg path: bindings/csharp/nupkgs/Ckzg.Bindings.*.nupkg
- name: Publish package
if: github.ref == 'refs/heads/main'
run: dotnet nuget push bindings/csharp/nupkgs/Ckzg.Bindings.*.nupkg --api-key ${{ secrets.CSHARP_NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json