Skip to content

Only deploy function related code and ignore terraform #2

Only deploy function related code and ignore terraform

Only deploy function related code and ignore terraform #2

Workflow file for this run

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 }}
respect-funcignore: true