Skip to content

Commit

Permalink
Merge branch 'master' into issues/21
Browse files Browse the repository at this point in the history
  • Loading branch information
asbjornu committed Oct 3, 2020
2 parents 181da33 + b6637a4 commit 9e39cb9
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 18 deletions.
133 changes: 116 additions & 17 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion src/json-ld.net/json-ld.net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Implements the W3C JSON-LD 1.0 standard.</Description>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RepositoryUrl>https://github.com/linked-data-dotnet/json-ld.net</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
Expand All @@ -36,4 +37,4 @@ Implements the W3C JSON-LD 1.0 standard.</Description>
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
</Project>
</Project>

0 comments on commit 9e39cb9

Please sign in to comment.