Skip to content

Commit

Permalink
Create release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tiakun committed Aug 12, 2023
1 parent bf05a24 commit f1bac1f
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Release to NuGet
on:
release:
types: [published]

env:
SOLUTION_NAME: Distractive.Formatters.sln

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Set up dependency caching for faster builds
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore "$SOLUTION_NAME"

- name: Build
run: dotnet build "$SOLUTION_NAME" -c Release --no-restore

- name: Test
run: dotnet test "$SOLUTION_NAME" -c Release --no-build --verbosity normal

- name: Publish to nuget.org
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json

0 comments on commit f1bac1f

Please sign in to comment.