Skip to content

chore: synced file(s) with prom-client-net/prom-client-tmpl #6

chore: synced file(s) with prom-client-net/prom-client-tmpl

chore: synced file(s) with prom-client-net/prom-client-tmpl #6

Workflow file for this run

name: Build
on:
pull_request:
branches:
- "main"
workflow_dispatch:
workflow_call:
jobs:
build:
name: Build, Test & Pack
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Build
run: dotnet build -c Release -p:ContinuousIntegrationBuild=true
- name: Run tests
run: dotnet test --no-build -c Release -p:CollectCoverage=true -e:CoverletOutputFormat=opencover
- name: Publish to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Set Dev version
if: github.ref == 'refs/heads/main'
run: |
version="$(git describe --long --tags | sed 's/^v//;0,/-/s//./')"
if [ -z "${version}" ]; then
version="0.0.0.$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)"
fi
echo "VERSION=${version}" >> $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 }}" -o nupkgs
- name: Upload artifacts
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: nupkgs
path: nupkgs/**/*nupkg