Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create azure-functions-app-nodejs.yml #507

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Leonelhdzm99
Copy link

name: Deploy Node.js project to Azure Function App

on:
push:
branches: ["master"]

env:
AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root
NODE_VERSION: '16.x' # set this to the node version to use (e.g. '8.x', '10.x', '12.x')

jobs:
build-and-deploy:
runs-on: windows-latest # For Linux, use ubuntu-latest
environment: dev
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

# If you want to use Azure RBAC instead of Publish Profile, then uncomment the task below
# - name: 'Login via Azure CLI'
#   uses: azure/login@v1
#   with:
#     creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository

- 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: pwsh # For Linux, use 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 }} # Remove publish-profile to use Azure RBAC

name: Deploy Node.js project to Azure Function App

on:
  push:
    branches: ["master"]

env:
  AZURE_FUNCTIONAPP_NAME: 'your-app-name'   # set this to your function app name on Azure
  AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'       # set this to the path to your function app project, defaults to the repository root
  NODE_VERSION: '16.x'                      # set this to the node version to use (e.g. '8.x', '10.x', '12.x')

jobs:
  build-and-deploy:
    runs-on: windows-latest # For Linux, use ubuntu-latest
    environment: dev
    steps:
    - name: 'Checkout GitHub Action'
      uses: actions/checkout@v3

    # If you want to use Azure RBAC instead of Publish Profile, then uncomment the task below
    # - name: 'Login via Azure CLI'
    #   uses: azure/login@v1
    #   with:
    #     creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository

    - 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: pwsh # For Linux, use 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 }} # Remove publish-profile to use Azure RBAC
@Leonelhdzm99
Copy link
Author

nombre: Implementar el proyecto Node.js en la aplicación de funciones de Azure

en: empujar: ramas: ["maestro"]

env: AZURE_FUNCTIONAPP_NAME: 'your-app-name' # establezca esto en el nombre de su aplicación de funciones en Azure AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # establezca esto en la ruta al proyecto de su aplicación de funciones, por defecto es la raíz del repositorio NODE_VERSION: '16.x' # establezca esto en la versión del nodo que se usará (por ejemplo, '8.x', '10.x', '12. X')

trabajos: compilar e implementar: se ejecuta en: windows-latest # Para Linux, use el entorno ubuntu-latest: pasos de desarrollo: - nombre: 'Checkout GitHub Action' usa: acciones/checkout@v3

# If you want to use Azure RBAC instead of Publish Profile, then uncomment the task below
# - name: 'Login via Azure CLI'
#   uses: azure/login@v1
#   with:
#     creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository

- 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: pwsh # For Linux, use 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 }} # Remove publish-profile to use Azure RBAC

1 similar comment
@Leonelhdzm99
Copy link
Author

nombre: Implementar el proyecto Node.js en la aplicación de funciones de Azure

en: empujar: ramas: ["maestro"]

env: AZURE_FUNCTIONAPP_NAME: 'your-app-name' # establezca esto en el nombre de su aplicación de funciones en Azure AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # establezca esto en la ruta al proyecto de su aplicación de funciones, por defecto es la raíz del repositorio NODE_VERSION: '16.x' # establezca esto en la versión del nodo que se usará (por ejemplo, '8.x', '10.x', '12. X')

trabajos: compilar e implementar: se ejecuta en: windows-latest # Para Linux, use el entorno ubuntu-latest: pasos de desarrollo: - nombre: 'Checkout GitHub Action' usa: acciones/checkout@v3

# If you want to use Azure RBAC instead of Publish Profile, then uncomment the task below
# - name: 'Login via Azure CLI'
#   uses: azure/login@v1
#   with:
#     creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository

- 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: pwsh # For Linux, use 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 }} # Remove publish-profile to use Azure RBAC

@Leonelhdzm99
Copy link
Author

De 453f74b lunes 17 de septiembre 00:00:00 2001
De: =?UTF-8?q?Leonel=20Hern=C3=A1ndez=20Manuel?=
147081818+Leonelhdzm99@users.noreply.github.com
Fecha: domingo 12 de noviembre de 2023 20:17:44 -0600
Asunto: [PARCHE] Crear azure-functions-app-nodejs.yml

nombre: Implementar el proyecto Node.js en la aplicación de funciones de Azure

en:
empujar:
ramas: ["maestro"]

entorno:
AZURE_FUNCTIONAPP_NAME: 'your-app-name' # establezca esto en el nombre de su aplicación de funciones en Azure
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # establezca esto en la ruta a su proyecto de aplicación de funciones, el valor predeterminado es la raíz del repositorio
NODE_VERSION: '16.x' # establece esto en la versión del nodo que se usará (por ejemplo, '8.x', '10.x', '12.x')

trabajos:
construir e implementar:
se ejecuta en: windows-latest # Para Linux, use ubuntu-latest
entorno: desarrollador
pasos:
- nombre: 'Pagar acción de GitHub'
usos: acciones/compra@v3

# Si desea utilizar Azure RBAC en lugar de Publicar perfil, descomente la tarea siguiente
# - nombre: 'Iniciar sesión a través de la CLI de Azure'
# usos: azure/login@v1
# con:
# creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # configura los secretos AZURE_RBAC_CREDENTIALS en tu repositorio

- nombre: Nodo de configuración ${{ env.NODE_VERSION }} Entorno
  usos: acciones/setup-node@v3
  con:
    versión-nodo: ${{ env.NODE_VERSION }}

- nombre: 'Resolver dependencias del proyecto usando Npm'
  shell: pwsh # Para Linux, use bash
  ejecutar: |
    pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
    instalación npm
    npm ejecutar compilación --si-presente
    npm ejecutar prueba --si-presente
    popd

- nombre: 'Ejecutar acción de Azure Functions'
  usos: Azure/functions-action@v1
  identificación: fa
  con:
    nombre de la aplicación: ${{ env.AZURE_FUNCTIONAPP_NAME }}
    paquete: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
    perfil de publicación: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Eliminar el perfil de publicación para usar Azure RBAC

.../workflows/azure-functions-app-nodejs.yml | 66 +++++++++++++++++++
1 archivo modificado, 66 inserciones(+)
crear modo 100644 .github/workflows/azure-functions-app-nodejs.yml

diff --git a/.github/workflows/azure-functions-app-nodejs.yml b/.github/workflows/azure-functions-app-nodejs.yml
nuevo modo de archivo 100644
índice 00000000..81881d13
--- /dev/nulo
+++ b/.github/workflows/azure-functions-app-nodejs.yml
@@ -0,0 +1,66 @@
+# Este flujo de trabajo creará un proyecto de Node.js y lo implementará en una aplicación de Azure Functions en Windows o Linux cuando se envíe una confirmación a su rama predeterminada.
+#
+# Este flujo de trabajo supone que ya ha creado la aplicación Azure Functions de destino.
+# Para obtener instrucciones, consulte:
+# - https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-node
+# - https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-typescript
+#
+# Para configurar este flujo de trabajo:
+# 1. Configure los siguientes secretos en su repositorio:
+# - AZURE_FUNCTIONAPP_PUBLISH_PROFILE
+# 2. Cambie las variables de entorno para su configuración.
+#
+# Para más información sobre:
+# - Acciones de GitHub para Azure: https://github.com/Azure/Actions
+# - Acción de funciones de Azure: https://github.com/Azure/functions-action
+# - Publicar perfil: https://github.com/Azure/functions-action#using-publish-profile-as-deployment-credential-recommended
+# - Principal de servicio de Azure para RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential
+#
+# Para obtener más ejemplos para comenzar con los flujos de trabajo de GitHub Action para implementar en Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp
+
+nombre: implementar el proyecto Node.js en la aplicación de funciones de Azure
+
+en:

  • empujar:
  • ramas: ["maestro"]

+entorno:

  • AZURE_FUNCTIONAPP_NAME: 'nombre-de-su-aplicación' # establezca esto en el nombre de su aplicación de funciones en Azure
  • AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # establezca esto en la ruta a su proyecto de aplicación de funciones, el valor predeterminado es la raíz del repositorio
  • NODE_VERSION: '16.x' # configura esto en la versión del nodo que se usará (por ejemplo, '8.x', '10.x', '12.x')

+trabajos:

  • construir e implementar:
  • se ejecuta: windows-latest # Para Linux, use ubuntu-latest
  • entorno: desarrollador
  • pasos:
    • nombre: 'Pagar acción de GitHub'
  • usos: acciones/pagar@v3
  • Si desea utilizar Azure RBAC en lugar de Publicar perfil, descomente la tarea siguiente

  • - nombre: 'Iniciar sesión a través de la CLI de Azure'

  • usos: azure/login@v1

  • con:

  • creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # configura los secretos AZURE_RBAC_CREDENTIALS en tu repositorio

    • nombre: Configurar nodo ${{ env.NODE_VERSION }} Entorno
  • usos: acciones/setup-node@v3
  • con:
  • versión-nodo: ${{ env.NODE_VERSION }}
    • nombre: 'Resolver dependencias del proyecto usando Npm'
  • shell: pwsh # Para Linux, use bash
  • ejecutar: |
  • pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
  • instalación npm
  • npm ejecutar compilación --si-presente
  • prueba de ejecución npm --si está presente
  • pop
    • nombre: 'Ejecutar acción de Azure Functions'
  • usos: Azure/funciones-action@v1
  • identificación: fa
  • con:
  • nombre de la aplicación: ${{ env.AZURE_FUNCTIONAPP_NAME }}
  • paquete: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
  • perfil de publicación: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Eliminar el perfil de publicación para usar Azure RBAC

Copy link
Author

@Leonelhdzm99 Leonelhdzm99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#507 ###

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants