Skip to content

TrustM365v1

TrustM365v1 #1

Workflow file for this run

name: Deploy to Azure App Service
on:
push:
branches: [ main ]
workflow_dispatch:
env:
NODE_VERSION: '20'
AZURE_WEBAPP_NAME: 'trustm365-antoporter' # ← update to your App Service name
jobs:
build-test-deploy:
runs-on: ubuntu-latest
steps:
# ── Checkout ────────────────────────────────────────────────────────────
- name: Checkout code
uses: actions/checkout@v4
# ── Node.js ─────────────────────────────────────────────────────────────
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: backend/package-lock.json
# ── Backend ─────────────────────────────────────────────────────────────
- name: Install backend dependencies
run: cd backend && npm ci
- name: Run backend tests
run: cd backend && npx jest --forceExit
# ── Frontend ────────────────────────────────────────────────────────────
- name: Install frontend dependencies
run: cd frontend && npm ci
- name: Build frontend
run: cd frontend && npm run build
# Output: frontend/dist/ — served via express.static in production
# ── Package ─────────────────────────────────────────────────────────────
- name: Create deployment package
run: |
zip -r deploy.zip \
backend/ \
frontend/dist/ \
package.json \
.env.example \
scripts/ \
-x "*/node_modules/*" \
-x "*/.git/*" \
-x "backend/test/*" \
-x "backend/data/*"
# ── Azure login (for startup config) ────────────────────────────────────
- name: Azure login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set startup command and Node version
run: |
az webapp config set \
--name ${{ env.AZURE_WEBAPP_NAME }} \
--resource-group trustm365-rg \
--startup-file "node backend/src/index.js" \
--linux-fx-version "NODE|20-lts"
# ── Deploy ──────────────────────────────────────────────────────────────
- name: Deploy to Azure App Service
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: deploy.zip