This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
chore(deps): update actions/setup-dotnet action to v4 #88
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
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 }} |