Skip to content

Merge pull request #302 from linked-data-dotnet/dependabot/nuget/main… #700

Merge pull request #302 from linked-data-dotnet/dependabot/nuget/main…

Merge pull request #302 from linked-data-dotnet/dependabot/nuget/main… #700

Workflow file for this run

name: dotnet
on:
push:
branches: [main, support/*]
tags: ["*"]
pull_request:
branches: [main, support/*]
jobs:
build:
runs-on: ubuntu-latest
outputs:
fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x
- id: gitversion
uses: gittools/actions/gitversion/[email protected]
- uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- uses: actions/cache@v4
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- run: dotnet restore
- run: dotnet build --configuration Release --no-restore
- run: |
dotnet test \
--configuration Release \
--no-build \
--no-restore \
-p:CollectCoverage=true \
-p:CoverletOutputFormat=opencover \
-p:Exclude="[JsonLD.Test*]*"
- name: Codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)
- run: |
dotnet pack \
--include-source \
--configuration Release \
--no-build \
--no-restore \
-p:PackageVersion="${{ steps.gitversion.outputs.fullSemVer }}" \
src/json-ld.net/json-ld.net.csproj \
--output ${{ github.workspace }}/nugets/
- uses: actions/upload-artifact@v4
with:
name: nugets
path: nugets
nuget-push-dev:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: build
steps:
- name: download artifact
uses: actions/download-artifact@v4
with:
name: nugets
- name: setup dotnet
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
source-url: https://nuget.pkg.github.com/linked-data-dotnet/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: nuget push
run: dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }}
nuget-push-prod:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: nugets
- uses: actions/[email protected]
with:
dotnet-version: 6.0.x
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
- name: nuget push
run: dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }}
release-artifacts:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
name: nugets
- name: Upload to stable release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: nugets
asset_name: json-ld.net
tag: ${{ github.ref }}
overwrite: true