Skip to content

Commit

Permalink
Update dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pwelter34 committed Aug 29, 2023
1 parent f5a14d2 commit 31a6787
Showing 1 changed file with 84 additions and 86 deletions.
170 changes: 84 additions & 86 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
ASPNETCORE_ENVIRONMENT: github
BUILD_PATH: '${{github.workspace}}/artifacts'
BUILD_PATH: "${{github.workspace}}/artifacts"
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

on:
Expand All @@ -13,23 +13,22 @@ on:
- master
- develop
tags:
- 'v*'
- "v*"
pull_request:
branches:
- master
- develop

jobs:

build:
runs-on: ubuntu-latest

services:
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
MSSQL_SA_PASSWORD: '!P@ssw0rd'
ACCEPT_EULA: 'Y'
MSSQL_SA_PASSWORD: "!P@ssw0rd"
ACCEPT_EULA: "Y"
ports:
- 1433:1433
volumes:
Expand All @@ -38,104 +37,103 @@ jobs:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: '!P@ssw0rd'
POSTGRES_PASSWORD: "!P@ssw0rd"
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: Restore Dependencies
run: dotnet restore

- name: Build Solution
run: dotnet build --no-restore --configuration Release

- name: Run Test
run: dotnet test --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings

- name: Generate Coverage
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.24
with:
reports: '${{github.workspace}}/test/*/TestResults/*/coverage.info'
targetdir: ${{env.BUILD_PATH}}
reporttypes: lcov

- name: Report Coverage
if: success()
uses: coverallsapp/github-action@v2
with:
file: '${{github.workspace}}/test/*/TestResults/*/coverage.info'
6.0.x
7.0.x
- name: Restore Dependencies
run: dotnet restore

- name: Build Solution
run: dotnet build --no-restore --configuration Release

- name: Run Test
run: dotnet test --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings

- name: Generate Coverage
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.24
with:
reports: "${{github.workspace}}/test/*/TestResults/*/coverage.info"
targetdir: ${{env.BUILD_PATH}}
reporttypes: lcov

- name: Report Coverage
if: success()
uses: coverallsapp/github-action@v2
with:
file: "${{github.workspace}}/test/*/TestResults/*/coverage.info"
format: lcov

- name: Create Packages
if: success() && github.event_name != 'pull_request'
run: dotnet pack --configuration Release --include-symbols --include-source --no-build --no-restore --output "${{env.BUILD_PATH}}"
- name: Create Packages
if: success() && github.event_name != 'pull_request'
run: dotnet pack --configuration Release --include-symbols --include-source --no-build --no-restore --output "${{env.BUILD_PATH}}"

- name: Upload Packages
if: success() && github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: packages
path: '${{env.BUILD_PATH}}'
- name: Upload Packages
if: success() && github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: packages
path: "${{env.BUILD_PATH}}"

- name: Install docfx
if: success() && startsWith(github.ref, 'refs/tags/v')
run: dotnet tool update -g docfx
- name: Install docfx
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
run: dotnet tool update -g docfx

- name: Create Documentation
if: success() && startsWith(github.ref, 'refs/tags/v')
run: docfx docs/docfx.json
- name: Create Documentation
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
run: docfx docs/docfx.json

- name: Deploy Documentation
if: success() && startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
- name: Deploy Documentation
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site

deploy:
runs-on: ubuntu-latest
needs: build
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))

steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: packages

- name: Publish Packages GitHub
run: |
for package in $(find -name "*.nupkg"); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
done
- name: Publish Packages feedz
run: |
for package in $(find -name "*.nupkg"); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate
done
- name: Publish Packages Nuget
if: startsWith(github.ref, 'refs/tags/v')
run: |
for package in $(find -name "*.nupkg"); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
done
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: packages

- name: Publish Packages GitHub
run: |
for package in $(find -name "*.nupkg"); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
done
- name: Publish Packages feedz
run: |
for package in $(find -name "*.nupkg"); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate
done
- name: Publish Packages Nuget
if: startsWith(github.ref, 'refs/tags/v')
run: |
for package in $(find -name "*.nupkg"); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
done

0 comments on commit 31a6787

Please sign in to comment.