Skip to content

Commit

Permalink
Added Deployment process for Az Fn
Browse files Browse the repository at this point in the history
  • Loading branch information
DrizzlyOwl committed Mar 8, 2024
1 parent d02aeac commit 22b59ca
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/deploy-fn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy Node.js project to Azure Function App

on:
push:
branches:
- main
workflow_dispatch:
inputs:
environment:
type: environment
description: "Choose an environment to deploy to"
required: true

env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: './azure-function'
NODE_VERSION: '18.x'

jobs:
set-env:
name: Determine environment
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.var.outputs.environment }}
steps:
- id: var
run: |
INPUT=${{ github.event.inputs.environment }}
ENVIRONMENT=${INPUT:-"development"}
echo "environment=${ENVIRONMENT,,}" >> $GITHUB_OUTPUT
build-and-deploy:
runs-on: ubuntu-latest
needs: set-env
environment: ${{ needs.set-env.outputs.environment }}
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: 'Resolve Project Dependencies Using Npm'
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
npm install
npm run build --if-present
npm run test --if-present
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ secrets.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}

0 comments on commit 22b59ca

Please sign in to comment.