Skip to content

Commit

Permalink
Refactoring CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
vanbukin committed Dec 29, 2023
1 parent baa311f commit 7d55bcd
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 45 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@ jobs:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
dotnet-version: 6.0.417
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- uses: actions/[email protected]
with:
dotnet-version: 8.0.100
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- run: dotnet build -c Release
- run: dotnet test -c Release
- name: Checkout
uses: actions/[email protected]
- name: Setup .NET SDK 6.0
uses: actions/[email protected]
with:
dotnet-version: 6.0.417
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- name: Setup .NET SDK 8.0
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- name: Build solution
run: dotnet build --configuration Release
- name: Run tests
run: dotnet test --configuration Release
79 changes: 49 additions & 30 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release and Publish

on:
release:
types: [ published ]
types: [published]

jobs:
build:
Expand All @@ -12,32 +12,51 @@ jobs:
DOTNET_CLI_TELEMETRY_OPTOUT: true
environment: Production
steps:
- uses: actions/[email protected]
with:
ref: ${{ github.sha }}
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/[email protected]
with:
dotnet-version: 6.0.417
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- uses: actions/[email protected]
with:
dotnet-version: 8.0.100
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- run: dotnet test -c Release
- run: dotnet pack -c Release -o out src/WebAuthn.Net
- run: dotnet pack -c Release -o out src/WebAuthn.Net.OpenTelemetry
- run: dotnet pack -c Release -o out src/WebAuthn.Net.Storage.InMemory
- run: dotnet pack -c Release -o out src/WebAuthn.Net.Storage.MySql
- run: dotnet pack -c Release -o out src/WebAuthn.Net.Storage.PostgreSql
- run: dotnet pack -c Release -o out src/WebAuthn.Net.Storage.SqlServer
- run: dotnet nuget push out/WebAuthn.Net.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- run: dotnet nuget push out/WebAuthn.Net.OpenTelemetry.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- run: dotnet nuget push out/WebAuthn.Net.Storage.InMemory.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- run: dotnet nuget push out/WebAuthn.Net.Storage.MySql.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- run: dotnet nuget push out/WebAuthn.Net.Storage.PostgreSql.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- run: dotnet nuget push out/WebAuthn.Net.Storage.SqlServer.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ github.sha }}
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Setup .NET SDK 6.0
uses: actions/[email protected]
with:
dotnet-version: 6.0.417
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- name: Setup .NET SDK 8.0
uses: actions/[email protected]
with:
dotnet-version: 8.0.100
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- name: Build solution
run: dotnet build --configuration Release
- name: Run tests
run: dotnet test --configuration Release
- name: Pack WebAuthn.Net
run: dotnet pack src/WebAuthn.Net/WebAuthn.Net.csproj --output out --configuration Release
- name: Pack WebAuthn.Net.OpenTelemetry
run: dotnet pack src/WebAuthn.Net.OpenTelemetry/WebAuthn.Net.OpenTelemetry.csproj --output out --configuration Release
- name: Pack WebAuthn.Net.Storage.InMemory
run: dotnet pack src/WebAuthn.Net.Storage.InMemory/WebAuthn.Net.Storage.InMemory.csproj --output out --configuration Release
- name: Pack WebAuthn.Net.Storage.MySql
run: dotnet pack src/WebAuthn.Net.Storage.MySql/WebAuthn.Net.Storage.MySql.csproj --output out --configuration Release
- name: Pack WebAuthn.Net.Storage.PostgreSql
run: dotnet pack src/WebAuthn.Net.Storage.PostgreSql/WebAuthn.Net.Storage.PostgreSql.csproj --output out --configuration Release
- name: Pack WebAuthn.Net.Storage.SqlServer
run: dotnet pack src/WebAuthn.Net.Storage.SqlServer/WebAuthn.Net.Storage.SqlServer.csproj --output out --configuration Release
- name: Publish package WebAuthn.Net
run: dotnet nuget push out/WebAuthn.Net.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- name: Publish package WebAuthn.Net.OpenTelemetry
run: dotnet nuget push out/WebAuthn.Net.OpenTelemetry.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- name: Publish package WebAuthn.Net.Storage.InMemory
run: dotnet nuget push out/WebAuthn.Net.Storage.InMemory.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- name: Publish package WebAuthn.Net.Storage.MySql
run: dotnet nuget push out/WebAuthn.Net.Storage.MySql.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- name: Publish package WebAuthn.Net.Storage.PostgreSql
run: dotnet nuget push out/WebAuthn.Net.Storage.PostgreSql.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}
- name: Publish package WebAuthn.Net.Storage.SqlServer
run: dotnet nuget push out/WebAuthn.Net.Storage.SqlServer.${{ env.RELEASE_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }}

0 comments on commit 7d55bcd

Please sign in to comment.