Skip to content

Initial commit: AuditSphere tRPC API for Azure Functions #1

Initial commit: AuditSphere tRPC API for Azure Functions

Initial commit: AuditSphere tRPC API for Azure Functions #1

Workflow file for this run

name: Build and Deploy to Azure Functions
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
AZURE_FUNCTIONAPP_NAME: 'auditsphere-api' # Update this with your Azure Function App name
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
NODE_VERSION: '20.x'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Generate Prisma Client
run: npm run db:generate
- name: Build TypeScript
run: npm run build
- name: Run tests
run: npm test
continue-on-error: true
- name: Upload build artifact
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: function-app
path: |
dist/
node_modules/
host.json
package.json
prisma/
retention-days: 1
deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
environment:
name: production
url: ${{ steps.deploy.outputs.webapp-url }}
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: function-app
path: .
- name: Deploy to Azure Functions
id: deploy
uses: Azure/functions-action@v1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}