Skip to content

ci: remove unused dotnet versions #164

ci: remove unused dotnet versions

ci: remove unused dotnet versions #164

Workflow file for this run

name: CI
on:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
branches:
- "main"
workflow_dispatch:
jobs:
build:
name: Build & Test
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
7.0.x
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release -p:ContinuousIntegrationBuild=true
- name: Run tests
run: dotnet test --no-build -c Release --filter FullyQualifiedName\!~Tests.Integration -p:CollectCoverage=true -e:CoverletOutputFormat=opencover
- name: Publish to Codecov
uses: codecov/codecov-action@v3
- name: Set Dev version
if: github.ref == 'refs/heads/main'
run: echo "VERSION=$(git describe --long --tags | sed 's/^v//;0,/-/s//./')" >> $GITHUB_ENV
- name: Set Release version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
- name: Pack NuGet artifacts
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
run: dotnet pack --no-build -c Release -p:PackageVersion="${{ env.VERSION }}"
- name: Upload artifacts
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: nupkgs
path: src/**/*nupkg
github:
name: Deploy to GitHub
needs: [build]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: nupkgs
- name: Push to pkg.github.com
run: dotnet nuget push "**/*.nupkg" -s https://nuget.pkg.github.com/prom-client-net/index.json -k ${{ secrets.GH_FULL_PAT }} --skip-duplicate
nuget:
name: Deploy to NuGet
needs: [build]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: nupkgs
- name: Push to nuget.org
run: dotnet nuget push "**/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }}