Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
- name: Restore
run: dotnet restore BlockingCollectionExtensions.sln

- name: Test
run: dotnet test BlockingCollectionExtensions.sln --configuration Release --no-restore

- name: Build net8.0
run: dotnet build BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --framework net8.0 --no-restore

- name: Build netstandard2.1
run: dotnet build BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --framework netstandard2.1 --no-restore

- name: Pack
run: dotnet pack BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --no-build -p:EnablePackageValidation=true -o artifacts

- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
34 changes: 26 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
name: Release

on:
workflow_dispatch:
inputs:
publish_to_nuget:
description: Publish packages to NuGet
required: true
default: false
type: boolean
push:
tags:
- 'v*'
workflow_dispatch:
- "v*.*.*"

jobs:
publish:
release:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout
Expand All @@ -28,16 +36,26 @@ jobs:

- name: Build netstandard2.1
run: dotnet build BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --framework netstandard2.1 --no-restore

- name: Test
run: dotnet test BlockingCollectionExtensions.sln --configuration Release --no-restore

- name: Pack
run: dotnet pack BlockingCollectionExtensions/BlockingCollectionExtensions.csproj --configuration Release --no-build -p:EnablePackageValidation=true -o artifacts

- name: Publish packages to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push "./artifacts/*.nupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate

- name: Upload release artifacts
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: release-packages
path: artifacts/*

- name: Publish to NuGet
if: startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_nuget
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
test -n "$NUGET_API_KEY"
dotnet nuget push "artifacts/*.nupkg" \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
Loading