Skip to content

generate analyzer package on build #328

generate analyzer package on build

generate analyzer package on build #328

Workflow file for this run

name: .NET Core
on:
# Run on all PRs
pull_request:
# Run when:
# - The main branch is pushed to, i.e. a PR targeting main is merged
# - The repo is tagged
push:
branches:
- main
tags:
- '*'
jobs:
build:
name: Github Actions Build
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.*
- name: Build Reason
run: echo ${{github.ref}} and ${{github.event_name}}
- name: Build with dotnet
run: >-
dotnet build
--configuration Release
--nologo
- name: Run tests
run: >-
dotnet test
--configuration Release
--logger trx
--no-build
--nologo
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: .NET tests
path: '**/*.trx'
reporter: dotnet-trx
# PR merged or main tag created, create the CarterTemplate NuGet package
- if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/newtonsoft-')
name: Create Carter template NuGet package
run: >-
dotnet pack ./template/Template.csproj
--configuration Release
--nologo
# PR merged, push prelease and CarterTemplate Carter packages to feedz
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads')
name: Push prelease and CarterTemplate Carter packages to feedz
run: ./push.sh carter feedz ${{ secrets.FEEDZ_KEY }}
# Main tag created, push Carter and CarterTemplate packages to NuGet
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && !startsWith(github.ref, 'refs/tags/newtonsoft-')
name: Push Carter and CarterTemplate packages to NuGet
run: ./push.sh carter nuget ${{ secrets.NUGET_KEY }}
# Newtonsoft tag created, push Newtonsoft package to NuGet
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && startsWith(github.ref, 'refs/tags/newtonsoft-')
name: Push Newtonsoft package to NuGet
run: ./push.sh newtonsoft nuget ${{ secrets.NUGET_KEY }}
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1