Skip to content

.NET 9

.NET 9 #1280

Workflow file for this run

name: .NET Library CI/CD
env:
PRERELEASE_BRANCHES: arkenstone # Comma separated list of prerelease branch names. 'alpha,rc, ...'
NUGET_OUTPUT: Artifacts/NuGet
COVERAGE_FOLDER: Coverage
on:
push:
branches:
- "**"
pull_request:
types: [closed]
jobs:
ci:
name: CI/CD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .Net
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.x
9.0.x
- name: Setup dotCover
run: dotnet tool install JetBrains.dotCover.GlobalTool -g
- name: Setup report generator
run: dotnet tool install dotnet-reportgenerator-globaltool -g
- name: Establish context
id: context
uses: dolittle/establish-context-action@v2
with:
prerelease-branches: ${{ env.PRERELEASE_BRANCHES }}
- name: Increment version
id: increment-version
if: ${{ steps.context.outputs.should-publish == 'true' }}
uses: dolittle/increment-version-action@v2
with:
version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ steps.increment-version.outputs.next-version || '0.0.0-prerelease' }}
files-to-update: Source/SDK/VersionInfo.cs
- name: Build
run: dotnet build --configuration Release
- name: Build Samples
working-directory: Samples
run: dotnet build
- name: Test
run: dotnet test --configuration Release --no-build
# - name: Create test coverage report
# run: dotnet dotcover test --dcXML=coverage.xml
# - name: Create Cobertura test coverage report
# run: reportgenerator -reports:CoverageReport.xml -targetdir:./ -reporttypes:Cobertura -filefilters:'-*.g.cs'
- name: Create release notes
id: create-release-notes
if: ${{ steps.context.outputs.should-publish == 'true' }}
uses: dolittle/create-release-notes-action@v1
with:
body: ${{ steps.context.outputs.pr-body }}
version: ${{ steps.increment-version.outputs.next-version }}
changelog-url: https://github.com/dolittle/DotNET.SDK/blob/master/CHANGELOG.md
output-format: msbuild
- name: Create packages
if: ${{ steps.context.outputs.should-publish == 'true' }}
run: dotnet pack --configuration Release -o ${{ env.NUGET_OUTPUT }} -p:Version=${{ steps.increment-version.outputs.next-version }} -p:PackageVersion=${{ steps.increment-version.outputs.next-version }} -p:PackageReleaseNotes="${{ steps.create-release-notes.outputs.plaintext }}"
- name: Prepend to Changelog
if: ${{ steps.context.outputs.should-publish == 'true' && steps.context.outputs.release-type != 'prerelease' }}
uses: dolittle/add-to-changelog-action@v2
with:
version: ${{ steps.increment-version.outputs.next-version }}
body: ${{ steps.context.outputs.pr-body }}
pr-url: ${{ steps.context.outputs.pr-url }}
changelog-path: CHANGELOG.md
user-email: [email protected]
user-name: dolittle-build
- name: Create GitHub Release
uses: dolittle/github-release-action@v2
if: ${{ steps.context.outputs.should-publish == 'true' }}
with:
token: ${{ secrets.BUILD_PAT }}
version: ${{ steps.increment-version.outputs.next-version }}
body: ${{ steps.context.outputs.pr-body }}
- name: Push NuGet packages
if: ${{ steps.context.outputs.should-publish == 'true' }}
run: dotnet nuget push --skip-duplicate '${{ env.NUGET_OUTPUT }}/*.nupkg' --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json