Create deploy.yml #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Azure Function | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| env: | |
| # Replace the value below with the name of your pre-created function app | |
| # (find it in the Azure Portal, e.g. carvedrock-func-xxxxxxxx). | |
| AZURE_FUNCTIONAPP_NAME: REPLACE_WITH_YOUR_FUNCTION_APP_NAME | |
| AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' | |
| NODE_VERSION: '20.x' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install dependencies (build and package) | |
| shell: bash | |
| run: | | |
| pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}' | |
| npm install --if-present | |
| popd | |
| - name: Deploy to Azure Functions | |
| 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 }} |