Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 3 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ on:

jobs:
build:
name: Build, Test & Pack
name: Build & Test
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
Expand All @@ -27,35 +26,11 @@ jobs:
- name: Build
run: dotnet build -c Release -p:ContinuousIntegrationBuild=true

- name: Run tests
- name: Run tests with Coverage
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
61 changes: 52 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,52 @@ jobs:
uses: ./.github/workflows/build.yml
secrets: inherit

pack:
name: Create NuGet packages
needs: [build]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- 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 artifacts
run: dotnet pack -p:PackageVersion="${{ env.VERSION }}" -o packages

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: packages/*nupkg

github:
name: Deploy to GitHub
needs: [build]
needs: [pack]
runs-on: ubuntu-24.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nupkgs
name: packages
- name: Push to pkg.github.com
run: dotnet nuget push "**/*.nupkg" -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GH_FULL_PAT }} --skip-duplicate
run: dotnet nuget push "*.nupkg" -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GH_FULL_PAT }} --skip-duplicate

nuget:
name: Deploy to NuGet
needs: [build]
release:
name: Create GitHub release
needs: [pack]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
steps:
Expand All @@ -36,10 +67,22 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nupkgs
name: packages
path: packages
- name: Create GitHub Release
run: gh release create ${{ github.ref_name }} **/*nupkg
run: gh release create ${{ github.ref_name }} packages/*nupkg
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

nuget:
name: Deploy to NuGet
needs: [release]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: packages
- name: Push to nuget.org
run: dotnet nuget push "**/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }}
run: dotnet nuget push "*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }}
Loading