Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Angular + .NET CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

# ======================= ANGULAR =======================
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
cache-dependency-path: BlogWebApp/Blog.Web/ClientApp/package-lock.json

- name: Install Angular dependencies
working-directory: BlogWebApp/Blog.Web/ClientApp
run: npm ci

- name: Build Angular
working-directory: BlogWebApp/Blog.Web/ClientApp
run: npm run build -- --configuration production

- name: Copy Angular build to wwwroot
run: |
rm -rf BlogWebApp/Blog.Web/wwwroot/*
cp -r BlogWebApp/Blog.Web/ClientApp/dist/* BlogWebApp/Blog.Web/wwwroot/

# ======================= DEBUG PATHS =======================
- name: Debug current directory
run: pwd

- name: List root
run: ls -la

- name: List BlogWebApp
run: ls -la BlogWebApp || true

- name: Find solution file
run: find . -name "*.sln"

# ======================= .NET =======================
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- name: Restore .NET
run: dotnet restore BlogWebApp/Blog.sln

- name: Build .NET
run: dotnet build BlogWebApp/Blog.sln --configuration Release --no-restore

- name: Run tests
run: dotnet test BlogWebApp/Blog.sln --no-build --verbosity normal

- name: Publish Web App
run: dotnet publish BlogWebApp/Blog.Web/Blog.Web.csproj -c Release -o out

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: webapp-build
path: out
Loading