🚀 pos-api CI/CD Pipeline — GitHub Actions to MonsterASP.Net
Automated deploy: push to
master→ build → test → publish → FTP deploy
📋 Overview
| Item | Detail |
|---|---|
| Repo | github.com/christianj27/pos-api |
| Framework | .NET 10 (ASP.NET Core Web API) |
| Database | PostgreSQL (Npgsql + EF Core) |
| Hosting | MonsterASP.Net shared hosting |
| Deploy method | FTP via GitHub Actions |
🔧 Prerequisites
1. GitHub Secrets
Add these in repo → Settings → Secrets and variables → Actions:
| Secret | Value |
|---|---|
FTP_HOST | site80268.siteasp.net |
FTP_USERNAME | site80268 |
FTP_PASSWORD | (from MonsterASP control panel) |
2. MonsterASP.Net — Environment Variables
Set these in the MonsterASP control panel → Environment Variables / App Settings:
| Variable | Value |
|---|---|
ASPNETCORE_ENVIRONMENT | Production |
ConnectionStrings__DefaultConnection | (MonsterASP PostgreSQL connection string) |
Jwt__SecretKey | (32+ char random secret) |
Note: Use double underscore
__for nested keys — .NET mapsConnectionStrings__DefaultConnectiontoConnectionStrings:DefaultConnectionautomatically.
📄 Workflow File
Create .github/workflows/deploy.yml in the repo root:
name: Deploy pos-api to MonsterASP.Net
on:
push:
branches: [master]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.x'
- name: Restore
run: dotnet restore Pos.slnx
- name: Build
run: dotnet build Pos.slnx --configuration Release --no-restore
- name: Run tests
run: dotnet test Pos.Test/Pos.Test.csproj --configuration Release --no-build
- name: Publish
run: dotnet publish Pos.Api/Pos.Api.csproj --configuration Release --no-build -o ./publish
- name: Deploy to MonsterASP.Net via FTP
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.FTP_HOST }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: ./publish/
server-dir: /wwwroot/🏃 Pipeline Stages
| # | Stage | Description |
|---|---|---|
| 1 | Checkout | Pulls latest code from master |
| 2 | Setup .NET | Installs .NET SDK 10.x on the runner |
| 3 | Restore | Downloads NuGet dependencies (dotnet restore) |
| 4 | Build | Compiles in Release mode (dotnet build) |
| 5 | Test | Runs xUnit tests with in-memory DB |
| 6 | Publish | Outputs deployable files to ./publish/ |
| 7 | FTP Deploy | Uploads everything to /wwwroot/ on MonsterASP |
🐛 Troubleshooting
Error: getaddrinfo ENOTFOUND
Cause: FTP_HOST secret is missing, empty, or has wrong value.
Fix: Check GitHub Secrets → FTP_HOST should be site80268.siteasp.net (no ftp:// prefix, no port).
Error: 500.30 — ASP.NET Core app failed to start
Cause: Missing or wrong environment variables on the server.
Fix: Set the MonsterASP environment variables listed above — especially ConnectionStrings__DefaultConnection and Jwt__SecretKey.
Error: HTTP 502 / 503
Cause: App pool crashed or DB connection failed.
Fix: Check MonsterASP event logs or temporarily enable stdout logging in web.config.