Skip to content

created github workflow for node js function app #1

created github workflow for node js function app

created github workflow for node js function app #1

# This workflow will build a container and deploy it to an Azure Functions App on Linux when a commit is pushed to your default branch.
#
# This workflow assumes you have already created the target Azure Functions app.
# For instructions see https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image?tabs=in-process%2Cbash%2Cazure-cli&pivots=programming-language-csharp
#
# To configure this workflow:
# 1. Set up the following secrets in your repository:
# - AZURE_RBAC_CREDENTIALS
# - REGISTRY_USERNAME
# - REGISTRY_PASSWORD
# 2. Change env variables for your configuration.
#
# For more information on:
# - GitHub Actions for Azure: https://github.com/Azure/Actions
# - Azure Functions Container Action: https://github.com/Azure/functions-container-action
# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential
#
# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp
name: Deploy Node.js project to Azure Function App
on:
push:
branches:
- internal
permissions:
contents: read
env:
AZURE_FUNCTIONAPP_NAME: 'testTimer'
AZURE_FUNCTIONAPP_PACKAGE_PATH: './azure_functions'
NODE_VERSION: '20.x'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT }}
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3
- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v3
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: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}