Skip to content

Instantly share code, notes, and snippets.

@jarrodlilkendey
Created August 19, 2024 00:50
Show Gist options
  • Save jarrodlilkendey/7cc5f62f926fd31537e539c6d79de8c7 to your computer and use it in GitHub Desktop.
Save jarrodlilkendey/7cc5f62f926fd31537e539c6d79de8c7 to your computer and use it in GitHub Desktop.
name: Deploy Azure Functions Node.js project to Azure Function App
on: [push]
env:
AZURE_FUNCTIONAPP_NAME: "cloudengineerskillsfuncapp"
AZURE_FUNCTIONAPP_PACKAGE_PATH: "."
NODE_VERSION: "20.x"
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@v3
- name: Install Azure CLI (required for self hosted runners like act)
run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- 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 }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment