Skip to content

Commit a96d227

Browse files
committed
ci: new ci
1 parent 87de871 commit a96d227

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: 💿 CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
tags:
8+
- "v*"
9+
pull_request:
10+
branches:
11+
- "master"
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
name: 🏭 Build & Test
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- name: 🚚 Checkout
20+
uses: actions/checkout@v3
21+
- name: 🛠 Setup .NET Core
22+
uses: actions/setup-dotnet@v2
23+
- name: ⚙ Restore
24+
run: dotnet restore
25+
- name: 🏭 Build
26+
run: dotnet build --no-restore -c Release /p:ContinuousIntegrationBuild=true
27+
- name: 🧪 Run tests
28+
run: dotnet test --no-build -c Release --filter FullyQualifiedName\!~Tests.Integration /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
29+
- name: ☢ Publish to Codecov
30+
uses: codecov/codecov-action@v2
31+
- name: 🗜 Pack Dev NuGet artifacts
32+
if: github.ref == 'refs/heads/master'
33+
run: dotnet pack --no-build -c Release --version-suffix dev-$(date +%s) -o artifacts/
34+
- name: 🗜 Pack NuGet artifacts
35+
if: startsWith(github.ref, 'refs/tags/v')
36+
run: dotnet pack --no-build -c Release -o artifacts/
37+
- name: 📤 Upload artifacts
38+
uses: actions/upload-artifact@v3
39+
with:
40+
name: nupkg
41+
path: artifacts/*
42+
43+
github:
44+
name: 🚀 Deploy to GitHub
45+
needs: [build]
46+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
47+
runs-on: ubuntu-22.04
48+
steps:
49+
- name: 📥 Download artifacts
50+
uses: actions/download-artifact@v2
51+
with:
52+
name: nupkg
53+
- name: 📦 Publish to GitHub
54+
run: dotnet nuget push "*.nupkg" -s https://nuget.pkg.github.com/prom-client-net/index.json -k ${{ secrets.GH_PKG_PAT }} --skip-duplicate
55+
nuget:
56+
name: 🚀 Deploy to Nuget
57+
needs: [build]
58+
if: startsWith(github.ref, 'refs/tags/v')
59+
runs-on: ubuntu-22.04
60+
steps:
61+
- name: 📥 Download artifacts
62+
uses: actions/download-artifact@v2
63+
with:
64+
name: nupkg
65+
- name: 📦 Publish to NuGet
66+
run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json

Prometheus.Client.MetricServer.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ ProjectSection(SolutionItems) = preProject
3131
.github\workflows\pr.yml = .github\workflows\pr.yml
3232
.github\workflows\master.yml = .github\workflows\master.yml
3333
.github\workflows\prod.yml = .github\workflows\prod.yml
34+
.github\workflows\ci.yml = .github\workflows\ci.yml
3435
EndProjectSection
3536
EndProject
3637
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Prometheus.Client.MetricServer", "src\Prometheus.Client.MetricServer.csproj", "{62E44DB5-72EE-46E1-AF9D-4654A618A90A}"

0 commit comments

Comments
 (0)