2021-10-11 12:53:15 -07:00
# This workflow will build and push a node.js application to an Azure Web App when there is a push to the $default-branch branch.
2019-11-13 12:29:30 -08:00
#
2020-03-31 11:26:59 -07:00
# This workflow assumes you have already created the target Azure App Service web app.
# For instructions see https://docs.microsoft.com/azure/app-service/app-service-plan-manage#create-an-app-service-plan
#
2019-11-13 12:29:30 -08:00
# To configure this workflow:
#
2020-11-05 22:32:30 +05:30
# 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**.
# For more instructions see: https://docs.microsoft.com/azure/app-service/configure-common#configure-app-settings
2020-11-03 18:21:34 +05:30
#
# 2. Set up a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE with the value of your Azure publish profile.
2020-03-31 11:26:59 -07:00
# For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret
2019-11-13 12:29:30 -08:00
#
2020-11-03 18:21:34 +05:30
# 3. Change the values for the AZURE_WEBAPP_NAME, AZURE_WEBAPP_PACKAGE_PATH and NODE_VERSION environment variables (below).
2019-11-13 12:29:30 -08:00
#
# For more information on GitHub Actions for Azure, refer to https://github.com/Azure/Actions
# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples
on :
2021-10-11 12:53:15 -07:00
push :
branches :
- $default-branch
2019-11-13 12:29:30 -08:00
env :
AZURE_WEBAPP_NAME : your-app-name # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH : '.' # set this to the path to your web app project, defaults to the repository root
NODE_VERSION : '10.x' # set this to the node version to use
jobs :
build-and-deploy :
name : Build and Deploy
runs-on : ubuntu-latest
2021-01-20 11:34:18 -05:00
environment : production
2019-11-13 12:29:30 -08:00
steps :
2019-12-24 14:22:22 -08:00
- uses : actions/checkout@v2
2019-11-13 12:29:30 -08:00
- name : Use Node.js ${{ env.NODE_VERSION }}
2021-03-13 14:34:06 +09:00
uses : actions/setup-node@v2
2019-11-13 12:29:30 -08:00
with :
node-version : ${{ env.NODE_VERSION }}
- name : npm install, build, and test
run : |
# Build and test the project, then
# deploy to Azure Web App.
npm install
npm run build --if-present
npm run test --if-present
- name : 'Deploy to Azure WebApp'
2020-03-09 15:57:09 +05:30
uses : azure/webapps-deploy@v2
2019-11-13 12:29:30 -08:00
with :
app-name : ${{ env.AZURE_WEBAPP_NAME }}
publish-profile : ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
2020-03-09 15:57:09 +05:30
package : ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}