Skip to content

Commit

Permalink
Create publish-nuget.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrandvd authored Aug 11, 2023
1 parent e524aab commit bc432fb
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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: Build

on:
push:
branches: [ "main" ]
tags:
- 'v*'
pull_request:
branches: [ "main" ]
tags:
- 'v*
env:
PROJECT_PATH: 'src/TonRadar.Fragment/TonRadar.Fragment.csproj'
TEST_PATH: 'src/TonRadar.Fragment.Test/TonRadar.Fragment.Test.csproj'
PACKAGE_OUTPUT_DIRECTORY: ${{ guthub.workspace }}/output
NUGET_SOURCE_URL: 'https://api.nuget.org/v3/index.json'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore ${{ env.PROJECT_PATH }}
- name: Build
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore
- name: Test
run: dotnet test ${{ env.TEST_PATH }} --filter GitHubActions!=Skip --no-build --verbosity normal

- name: 'Get Version'
id: version
uses: battila7/get-version-action@v2

- name: 'Pack project'
run: dotnet pack ${{ env.PROJECT_PATH }} --no-restore --no-build --configuration Release --include-symbols -p:PackageVersion=${{ steps.version.outputs.version-without-v }} --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}

- name: 'Push package'
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}\*.nupkg -k ${{ secrets.NUGET_KEY }} -s ${{ env.NUGET_SOURCE_URL }}

0 comments on commit bc432fb

Please sign in to comment.