update build #6
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: Build Project | |
env: | |
ASPNETCORE_ENVIRONMENT: github | |
BUILD_PATH: '${{github.workspace}}/artifacts' | |
BUILD_VERSION: '10.1.${{github.run_number}}' | |
BUILD_INFORMATION: '10.1.${{github.run_number}}+Branch.${{github.ref_name}}.Sha.${{github.sha}}' | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
tags: | |
- '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' | |
ports: | |
- 1433:1433 | |
volumes: | |
- mssql_data:/var/opt/mssql | |
postgres: | |
image: postgres | |
env: | |
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: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
- name: Restore Dependencies | |
run: dotnet restore | |
- name: Build Solution | |
run: dotnet build --no-restore --configuration Release -p:Version="${{env.BUILD_VERSION}}" -p:InformationalVersion="${{env.BUILD_INFORMATION}}" | |
- name: Run Test | |
run: dotnet test --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings | |
- name: Report Coverage | |
if: success() | |
uses: coverallsapp/github-action@v2 | |
- 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}}" -p:PackageVersion="${{env.BUILD_VERSION}}" | |
- name: Upload Packages | |
if: success() && github.event_name != 'pull_request' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: '${{env.BUILD_PATH}}' | |
- name: Publish Packages | |
if: success() && github.event_name != 'pull_request' | |
run: | | |
dotnet nuget add source --username pwelter34 --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/loresoft/index.json" | |
for package in $(find -name "*.nupkg"); do | |
echo "${0##*/}": Pushing $package... | |
dotnet nuget push $package --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate | |
done | |
- name: Publish Release Packages | |
if: success() && 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 |