This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
generated from tomkerkhove/template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (45 loc) · 1.83 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
NUGET_PACKAGE_VERSION: 0.1.0
jobs:
build:
runs-on: ubuntu-latest
name: Build & Test Code
steps:
- uses: actions/checkout@v3
- name: Set version suffix for main branch
uses: allenevans/[email protected]
with:
VERSION_SUFFIX: ${{ github.sha }}
# Set NuGet package name since env.NUGET_PACKAGE_NAME doesn't resolve the variables
- name: Set NuGet package name
uses: allenevans/[email protected]
with:
NUGET_PACKAGE_NAME: Promitor.Parsers.Prometheus.Core.${{ env.NUGET_PACKAGE_VERSION }}-$VERSION_SUFFIX.nupkg
# Set NuGet package name since env.NUGET_PACKAGE_PATH doesn't resolve the variables
- name: Set NuGet package path
uses: allenevans/[email protected]
with:
NUGET_PACKAGE_PATH: ./src/Promitor.Parsers.Prometheus.Core/bin/Release/${{ env.NUGET_PACKAGE_NAME }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'
- name: Restore dependencies
run: dotnet restore src/Promitor.Parsers.Prometheus.sln
- name: Build
run: dotnet build src/Promitor.Parsers.Prometheus.sln --no-restore --configuration Release -p:Version=${{ env.NUGET_PACKAGE_VERSION }}-$VERSION_SUFFIX
- name: Test
run: dotnet test src/Promitor.Parsers.Prometheus.Tests/Promitor.Parsers.Prometheus.Tests.csproj --no-build --verbosity normal --configuration Release
- name: Push NuGet package
run: dotnet nuget push "${{ env.NUGET_PACKAGE_PATH }}" --api-key ${{ secrets.NUGET_REGISTRY_GHPR_PAT }} --source "https://nuget.pkg.github.com/tomkerkhove/index.json"
- name: Upload NuGet Package
uses: actions/upload-artifact@v3
with:
name: ${{ env.NUGET_PACKAGE_NAME }}
path: ${{ env.NUGET_PACKAGE_PATH }}