Skip to content

v1.0.0

v1.0.0 #2

Workflow file for this run

name: Release
# Publishes both packages (and symbol packages) to NuGet when a GitHub Release is published.
on:
release:
types: [published]
permissions:
contents: read
id-token: write # required for NuGet Trusted Publishing (OIDC)
jobs:
publish:
name: Pack & publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
- name: Derive version from tag
id: version
run: echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Restore
run: dotnet restore
- name: Verify formatting
run: dotnet format --verify-no-changes --severity warn
- name: Build
run: dotnet build -c Release --no-restore -p:Version=${{ steps.version.outputs.value }} -p:ContinuousIntegrationBuild=true
- name: Test
run: dotnet test -c Release --no-build
- name: Pack
run: |
dotnet pack src/TestingBot.Api/TestingBot.Api.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.value }} -o ./artifacts
dotnet pack src/TestingBot.Api.DependencyInjection/TestingBot.Api.DependencyInjection.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.value }} -o ./artifacts
- name: NuGet login (Trusted Publishing)
id: login
uses: NuGet/login@v1
with:
# nuget.org username that owns the Trusted Publishing policy (the policy
# creator), not the package owner org. The org "testingbot" owns the
# packages, but the policy is created under this personal account.
user: testingbot-jochen
- name: Push to NuGet
run: dotnet nuget push "./artifacts/*.nupkg" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Upload packages
uses: actions/upload-artifact@v7
with:
name: packages
path: ./artifacts/*.*nupkg