From 73e48f3861595db18536e6466c6bdba949ffaf8d Mon Sep 17 00:00:00 2001 From: Mehran Davoudi Date: Mon, 25 Dec 2023 00:35:25 +0330 Subject: [PATCH] Create publish-nuget.yml --- .github/workflows/publish-nuget.yml | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/publish-nuget.yml diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml new file mode 100644 index 0000000..0a6e5ca --- /dev/null +++ b/.github/workflows/publish-nuget.yml @@ -0,0 +1,43 @@ +# 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: Publish to Nuget + +on: + push: + tags: + - 'v*' + +env: + PROJECT_PATH: 'src/skUnit/skUnit.csproj' + TEST_PATH: 'src/skUnit.Test/skUnit.Test.csproj' + PACKAGE_OUTPUT_DIRECTORY: ${{ github.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: 8.0.x + - name: Restore dependencies + run: dotnet restore ${{ env.PROJECT_PATH }} + - name: Build + run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release +# - 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:SymbolPackageFormat=snupkg -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 }}