Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffpatton1971 authored Jan 9, 2024
1 parent 4a2f28d commit f5dec12
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: .NET 7 Build, Test, and Release Process

on:
push:
branches: [ main ]

jobs:
build_and_test:
runs-on: windows-latest
outputs:
should-run: ${{ steps.set-output.outputs.should-run }}

steps:
- uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'

- name: Restore dependencies
run: dotnet restore ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln

- name: Clean
run: dotnet clean ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release

- name: Build
run: dotnet build ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release --no-restore

- name: Test
run: dotnet test ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release --no-build

- name: Set Output
run: echo "::set-output name=should-run::true"
id: set-output

project_operations:
needs: build_and_test
if: needs.build_and_test.outputs.should-run == 'true'
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Generate Release Notes from Milestone
uses: jeffpatton1971/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
milestone: '<YourMilestone>'

pack_and_publish:
needs: [build_and_test, project_operations]
if: needs.build_and_test.outputs.should-run == 'true'
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'

- name: Package
run: dotnet pack ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release --no-build --output nupkgs

- name: Publish NuGet Package
run: |
nuget push **/*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

0 comments on commit f5dec12

Please sign in to comment.