LANCommander/.github/workflows/LANCommander.Cache.yml
2025-03-20 20:03:46 -05:00

97 lines
No EOL
2.4 KiB
YAML

name: LANCommander Server Restore
on:
workflow_dispatch:
workflow_call:
inputs:
build_dotnet_version:
description: 'Build .NET Version'
required: true
type: string
permissions:
contents: write
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/package
jobs:
build:
runs-on: windows-latest
steps:
- uses: frabert/replace-string-action@v2
name: Swap Path Backslashes
id: swap_path_backslashes
with:
string: '${{ github.workspace }}'
pattern: '\\'
replace-with: '/'
flags: g
# Checkout code
- uses: actions/checkout@v3
with:
submodules: true
# .NET Setup and Caching
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.build_dotnet_version }}
- name: Restore dependencies
run: dotnet restore --locked-mode
- name: NuGet Cache
uses: actions/cache/save@v4
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-dotnet-${{ hashFiles('**/*.csproj') }}
# Node.js Setup and Caching
- name: Setup Node.js
uses: actions/setup-node@v3.8.1
with:
node-version: '20'
# Parallel UI builds
- name: Build UI Components
run: |
cd ./LANCommander.UI
npm install
npm run package
- name: Cache UI npm packages
uses: actions/cache/save@v4
with:
path: ./LANCommander.UI/node_modules
key: LANCommander.UI-npm-${{ hashFiles('**/package-lock.json') }}
- name: Cache UI build
uses: actions/cache/save@v4
with:
path: ./LANCommander.UI/wwwroot
key: LANCommander.UI-${{ hashFiles('**/package-lock.json') }}
- name: Install Server Node Dependencies
run: |
cd ./LANCommander.Server
npm install
- name: Cache Server npm packages
uses: actions/cache/save@v4
with:
path: ./LANCommander.Server/node_modules
key: LANCommander.Server-npm-${{ hashFiles('**/package-lock.json') }}
- name: Install Launcher Node Dependencies
run: |
cd ./LANCommander.Launcher
npm install
- name: Cache Launcher npm packages
uses: actions/cache/save@v4
with:
path: ./LANCommander.Launcher/node_modules
key: LANCommander.Launcher-npm-${{ hashFiles('**/package-lock.json') }}