Update nuget tags #19
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: .NET Core Build and Publish | |
on: | |
push: | |
branches: master | |
pull_request: | |
branches: master | |
env: | |
NETCORE_VERSION: '8.0.x' | |
GIT_REPO_ROOT: src | |
MAJOR_MINOR_VERSION: 1.1. | |
SOLUTION_FILE: ApplicationInsights.sln | |
jobs: | |
build: | |
name: Build Package | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core SDK ${{ env.NETCORE_VERSION }} | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.NETCORE_VERSION }} | |
- name: Restore | |
working-directory: ${{ env.GIT_REPO_ROOT }} | |
run: dotnet restore ${{ env.SOLUTION_FILE }} | |
- name: Build | |
working-directory: ${{ env.GIT_REPO_ROOT }} | |
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration Debug --no-restore | |
# - name: Run Unit Tests and Generate Coverage | |
# uses: glennawatson/coverlet-msbuild@v1 | |
# with: | |
# project-files: '**/*Tests.csproj' | |
# no-build: true | |
# output-format: cobertura | |
# output: results | |
# configuration: Debug | |
- name: run unit test | |
working-directory: ${{ env.GIT_REPO_ROOT }} | |
run: dotnet test ${{ env.SOLUTION_FILE }} | |
- name: Pack | |
working-directory: ${{ env.GIT_REPO_ROOT }} | |
run: dotnet pack ${{ env.SOLUTION_FILE }} --configuration Debug -o finalpackage -p:PackageVersion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }} | |
- name: Publish artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: nupkg | |
path: ${{ env.GIT_REPO_ROOT }}/finalpackage | |
# - uses: codecov/codecov-action@v3 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# files: src/Agoda.IoC.Unity.UnitTests/results.cobertura.xml,src/Agoda.IoC.Unity.NetCore/results.cobertura.xml,src/Agoda.IoC.Unity.AutofacExt/results.cobertura.xml,src/Generator/UnitTests/Agoda.IoC.Generator.UnitTests/results.cobertura.xml # optional | |
# fail_ci_if_error: true # optional (default = false) | |
deploy: | |
needs: build | |
if: github.ref == 'refs/heads/master' | |
name: Deploy Packages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Package artifact | |
uses: actions/download-artifact@master | |
with: | |
name: nupkg | |
path: ./nupkg | |
- name: Setup NuGet | |
uses: NuGet/[email protected] | |
with: | |
nuget-api-key: ${{ secrets.NUGET_API_KEY }} | |
nuget-version: latest | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.NETCORE_VERSION }} | |
- name: Push to NuGet | |
run: dotnet nuget push nupkg/**/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://nuget.org --skip-duplicate |