calorie-tracker/.forgejo/workflows/build.yml
OpenClaw CI 865a7da928
Some checks failed
Build & Test / build (push) Failing after 2s
Build & Test / publish-client (push) Has been skipped
Build & Test / publish-api (push) Has been skipped
Add CI/CD pipeline for Blazor WASM + API build & deploy
2026-06-07 20:04:20 +00:00

62 lines
1.7 KiB
YAML

name: Build & Test
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:10.0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
publish-client:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:10.0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish Blazor WASM Client
run: dotnet publish src/CalorieTracker.Client -c Release -o /tmp/publish/client
- name: Deploy Client
run: |
echo "Deploying CalorieTracker WASM to /srv/web/calorie.holoshaii.dev/"
mkdir -p /srv/web/calorie.holoshaii.dev
cp -r /tmp/publish/client/wwwroot/* /srv/web/calorie.holoshaii.dev/
publish-api:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:10.0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish API
run: dotnet publish src/CalorieTracker.Api -c Release -o /tmp/publish/api
- name: Deploy API
run: |
echo "Deploying CalorieTracker API..."
mkdir -p /opt/calorie-tracker
cp -r /tmp/publish/api/* /opt/calorie-tracker/
# Restart API service (if running as systemd)
sudo systemctl restart calorie-tracker || echo "API service not yet configured"