Files
Servers/.gitea/workflows/publish-nuget.yml

70 lines
1.9 KiB
YAML

name: "Dev Publish: Nuget"
on:
workflow_dispatch:
push:
branches:
- v2.1
paths:
- 'MoonlightServers.*/*.csproj'
env:
NUGET_SOURCE: https://git.battlestati.one/api/packages/Moonlight-Panel/nuget/index.json
NUGET_PUBLIC: https://api.nuget.org/v3/index.json
CONFIGURATION: Debug
jobs:
publish:
name: Publish ${{ matrix.project }}
runs-on: linux_amd64
strategy:
matrix:
project:
- MoonlightServers.Api
- MoonlightServers.Shared
- MoonlightServers.DaemonShared
- MoonlightServers.Frontend
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Restore NuGet packages
run: >
dotnet restore ${{ matrix.project }}
--source ${{ env.NUGET_PUBLIC }}
--source ${{ env.NUGET_SOURCE }}
# Frontend requires a host build + Tailwind compilation first
- name: Build frontend host (Frontend only)
if: matrix.project == 'MoonlightServers.Frontend'
run: >
dotnet build Hosts/MoonlightServers.Frontend.Host
--configuration ${{ env.CONFIGURATION }}
--no-restore
- name: Build Tailwind styles (Frontend only)
if: matrix.project == 'MoonlightServers.Frontend'
working-directory: Hosts/MoonlightServers.Frontend.Host/Styles
run: npm install && npm run build
- name: Build project
run: >
dotnet build ${{ matrix.project }}
--configuration ${{ env.CONFIGURATION }}
--no-restore
- name: Pack NuGet package
run: >
dotnet pack ${{ matrix.project }}
--configuration ${{ env.CONFIGURATION }}
--output ./artifacts
--no-build
- name: Push NuGet package
run: >
dotnet nuget push ./artifacts/*.nupkg
--skip-duplicate
--source ${{ env.NUGET_SOURCE }}
--api-key ${{ secrets.ACCESS_TOKEN }}