Vastly improved unit test coverage and consistency #51
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: dotnet | |
on: | |
push: | |
branches: [ main ] | |
tags: ["*"] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '5.0.x' | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '3.1.x' | |
- uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: "5.x" | |
- id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Test | |
run: dotnet test --configuration Release --no-build --verbosity normal | |
- run: | | |
dotnet pack \ | |
--include-source \ | |
--include-symbols \ | |
--configuration Release \ | |
--no-build \ | |
--no-restore \ | |
-p:PackageVersion="${{ steps.gitversion.outputs.fullSemVer }}" \ | |
RegExtract/RegExtract.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/main' | |
needs: build | |
steps: | |
- name: download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: nugets | |
- name: setup dotnet | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1 | |
source-url: https://nuget.pkg.github.com/sblom/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: nuget push | |
run: dotnet nuget push *.nupkg *.snupkg --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: 3.1 | |
source-url: https://api.nuget.org/v3/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }} | |
- run: dotnet nuget push *.nupkg *.snupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} |