diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 654f1e1..c913536 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -19,6 +19,9 @@ jobs: modularpipeline: environment: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Pull Requests' }} runs-on: ubuntu-latest + permissions: + contents: write + id-token: write steps: - uses: actions/checkout@v7 @@ -33,11 +36,18 @@ jobs: 8.0.x 9.0.x 10.0.x + - name: NuGet login + if: ${{ github.ref == 'refs/heads/main' && github.event.inputs.publish-packages == 'true' }} + uses: NuGet/login@v1 + id: login + with: + user: ${{ secrets.NUGET_USER }} + - name: Run Pipeline run: dotnet run -c Release working-directory: "EnumerableAsyncProcessor.Pipeline" env: DOTNET_ENVIRONMENT: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Development' }} - NuGet__ApiKey: ${{ github.ref == 'refs/heads/main' && secrets.NuGet__ApiKey || null }} + NuGet__ApiKey: ${{ steps.login.outputs.NUGET_API_KEY }} PULL_REQUEST_BRANCH: ${{ github.event.pull_request.head.ref }} PUBLISH_PACKAGES: ${{ github.event.inputs.publish-packages }}