Add deploy nuget workflow #3
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 | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ windows-latest, macos-latest, ubuntu-latest ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Validate generated css files | |
run: | | |
test -s Samples/AspNetCore.SassCompiler.Sample31/wwwroot/css/site_sass.css | |
test -s Samples/AspNetCore.SassCompiler.Sample/wwwroot/css/site_sass.css | |
test -s Samples/AspNetCore.SassCompiler.BlazorSample/Pages/Counter.razor.css | |
test -s Samples/AspNetCore.SassCompiler.BlazorSample/obj/Release/net6.0/scopedcss/Pages/Counter.razor.rz.scp.css | |
publish: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Publish NuGet | |
id: publish_nuget | |
uses: alirezanet/[email protected] | |
with: | |
PROJECT_FILE_PATH: AspNetCore.SassCompiler/AspNetCore.SassCompiler.csproj | |
PACKAGE_NAME: AspNetCore.SassCompiler | |
env: | |
NUGET_KEY: ${{ secrets.NUGET_KEY }} | |
- name: Create release | |
id: create_release | |
if: success() && steps.publish_nuget.outputs.version != '' | |
run: gh release create ${{ steps.publish_nuget.outputs.version }} --generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |