Skip to content

Publish to NuGet

Publish to NuGet #310

name: "Publish to NuGet"
on:
workflow_dispatch:
# push:
# branches: [ "master" ]
# pull_request:
# branches: [ "master" ]
jobs:
build:
runs-on: windows-2022
steps:
# Checkout
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
with:
egress-policy: audit
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
#Setup .NET Core
- name: Setup .NET
uses: actions/setup-dotnet@87b7050bc53ea08284295505d98d2aa94301e852 # v4.2.0
with:
dotnet-version: 8.x
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}}
# Setup Node.js
- name: Use Node.js 20.x
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
# Npm Install and build Identity UI
- name: NPM Install and Build Identity UI
run: |
cd src/Indice.Features.Identity.UI
npm install --force
npm run gulp -- copy:libs
npm run gulp -- sass
# Npm Install Cases
- name: NPM Install Cases
run: |
cd src/Indice.Features.Cases.App
npm install
# Npm Install AdminUI
- name: NPM Install AdminUI
run: |
cd src/Indice.Features.Identity.AdminUI.App
npm install
# # Npm Install Messages
- name: NPM Install Messages
run: |
cd src/Indice.Features.Messages.App
npm install
# # Npm Install Risk App
- name: NPM Install Risk
run: |
cd src/Indice.Features.Risk.App
npm install
#Create .nuget dir
- name: Create .nuget dir
shell: pwsh
run: |
if (!(Test-Path -Path ".\.nuget" ))
{
New-Item -ItemType "directory" -Path ".\.nuget"
}
if (!(Test-Path -Path ".\.nuget\packages" ))
{
New-Item -ItemType "directory" -Path ".\.nuget\packages"
}
# BUILD
- name: Dotnet restore
run: dotnet restore /nowarn:netsdk1138
- name: Dotnet build SPAs
run: dotnet build Indice.Platform.Ecmascript.slnf --no-restore --configuration Release
- name: Dotnet build
run: dotnet build Indice.Platform.slnf --no-restore --configuration Release
# TEST
- name: Test with dotnet
run: dotnet test --no-build --configuration Release --logger trx --results-directory "TestResults"
# TEST REPORT
- name: Test Reporter
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1
if: always()
with:
name: DotNET Tests
path: "TestResults/*.trx"
reporter: dotnet-trx
fail-on-error: true
# Pack
- name: Generate NuGet package
run: ./pack.ps1
# Push to NuGet
- name: Push generated package to GitHub registry
run: dotnet nuget push '**/Indice*.nupkg' --skip-duplicate -k ${{ secrets.NUGET_AUTH_TOKEN }}