|
| 1 | +# This workflow will build and push a node.js application to an Azure Web App when a release is created. |
| 2 | +# |
| 3 | +# This workflow assumes you have already created the target Azure App Service web app. |
| 4 | +# For instructions see https://docs.microsoft.com/azure/app-service/app-service-plan-manage#create-an-app-service-plan |
| 5 | +# |
| 6 | +# To configure this workflow: |
| 7 | +# |
| 8 | +# 1. For Linux apps, add an app setting called WEBSITE_WEBDEPLOY_USE_SCM and set it to true in your app **before downloading the file**. |
| 9 | +# For more instructions see: https://docs.microsoft.com/azure/app-service/configure-common#configure-app-settings |
| 10 | +# |
| 11 | +# 2. Set up a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE with the value of your Azure publish profile. |
| 12 | +# For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret |
| 13 | +# |
| 14 | +# 3. Change the values for the AZURE_WEBAPP_NAME, AZURE_WEBAPP_PACKAGE_PATH and NODE_VERSION environment variables (below). |
| 15 | +# |
| 16 | +# For more information on GitHub Actions for Azure, refer to https://github.com/Azure/Actions |
| 17 | +# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples |
| 18 | +on: |
| 19 | + release: |
| 20 | + types: [created] |
| 21 | + |
| 22 | +env: |
| 23 | + AZURE_WEBAPP_NAME: test-node-app-123 # set this to your application's name |
| 24 | + AZURE_WEBAPP_PACKAGE_PATH: './Azure/Azure-NodeJs-CI' # set this to the path to your web app project, defaults to the repository root |
| 25 | + NODE_VERSION: '14.x' # set this to the node version to use |
| 26 | + |
| 27 | +jobs: |
| 28 | + build-and-deploy: |
| 29 | + name: Build and Deploy |
| 30 | + runs-on: ubuntu-latest |
| 31 | + environment: production |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v2 |
| 34 | + - name: Use Node.js ${{ env.NODE_VERSION }} |
| 35 | + uses: actions/setup-node@v2 |
| 36 | + with: |
| 37 | + node-version: ${{ env.NODE_VERSION }} |
| 38 | + - name: npm install, build, and test |
| 39 | + run: | |
| 40 | + # Build and test the project, then |
| 41 | + # deploy to Azure Web App. |
| 42 | + npm install |
| 43 | + |
| 44 | + - name: 'Deploy to Azure WebApp' |
| 45 | + uses: azure/webapps-deploy@v2 |
| 46 | + with: |
| 47 | + app-name: ${{ env.AZURE_WEBAPP_NAME }} |
| 48 | + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} |
| 49 | + package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} |
0 commit comments