diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 1ca89c8..1869752 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -2,32 +2,131 @@ name: dotnet
on:
push:
- branches: [ master ]
+ branches: [master]
+ tags: ["*"]
pull_request:
- branches: [ master ]
+ branches: [master]
jobs:
build:
runs-on: ubuntu-latest
+ outputs:
+ fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}
+
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - uses: gittools/actions/gitversion/setup@v0.9.4
+ with:
+ versionSpec: "5.x"
+
+ - id: gitversion
+ uses: gittools/actions/gitversion/execute@v0.9.4
+
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 2.1.401
+
+ - uses: actions/cache@v2
+ 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
- - name: Setup .NET Core
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 2.1.401
+ - run: dotnet build --configuration Release --no-restore
- - name: Install dependencies
- run: dotnet restore
+ - run: |
+ dotnet test \
+ --configuration Release \
+ --no-build \
+ --no-restore \
+ -p:CollectCoverage=true \
+ -p:CoverletOutputFormat=opencover \
+ -p:Exclude="[JsonLD.Test*]*"
- - name: Build
- run: dotnet build --configuration Release --no-restore
+ - 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@v2
+ with:
+ name: nugets
+ path: nugets
+
+ nuget-push-dev:
+ runs-on: ubuntu-latest
+ if: github.ref == 'refs/heads/master'
+ needs: build
+
+ steps:
+ - name: download artifact
+ uses: actions/download-artifact@v2
+ with:
+ name: nugets
- - name: Test
- run: dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[JsonLD.Test*]*"
+ - name: setup dotnet
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 3.1
+ 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@v2
+ with:
+ name: nugets
+
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 2.1.401
+ source-url: https://api.nuget.org/v3/index.json
+ env:
+ NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
+
+ - run: dotnet nuget push nugets/*.nupkg --skip-duplicate
+
+ release-artifacts:
+ runs-on: ubuntu-latest
+ needs: build
+ if: startsWith(github.ref, 'refs/tags/')
+
+ steps:
+ - uses: actions/download-artifact@v1
+ with:
+ name: nugets
- - name: Codecov
- env:
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- run: bash <(curl -s https://codecov.io/bash)
+ - name: Upload to stable release
+ uses: svenstaro/upload-release-action@v1-release
+ with:
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ file: nugets
+ asset_name: json-ld.net
+ tag: ${{ github.ref }}
+ overwrite: true
diff --git a/src/json-ld.net/json-ld.net.csproj b/src/json-ld.net/json-ld.net.csproj
index 3bd4f7c..62f84ac 100644
--- a/src/json-ld.net/json-ld.net.csproj
+++ b/src/json-ld.net/json-ld.net.csproj
@@ -17,6 +17,7 @@ Implements the W3C JSON-LD 1.0 standard.
false
false
false
+ https://github.com/linked-data-dotnet/json-ld.net
@@ -36,4 +37,4 @@ Implements the W3C JSON-LD 1.0 standard.
-
\ No newline at end of file
+