Skip to content

Commit af7cb12

Browse files
Create azure.yml
1 parent a1b243e commit af7cb12

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/azure.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow will build and push a node.js application to an Azure Web App when there is a push to the main branch.
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+
push:
20+
branches:
21+
- main
22+
23+
env:
24+
AZURE_WEBAPP_NAME: your-app-name # set this to your application's name
25+
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
26+
NODE_VERSION: '10.x' # set this to the node version to use
27+
28+
jobs:
29+
build-and-deploy:
30+
name: Build and Deploy
31+
runs-on: ubuntu-latest
32+
environment: production
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Use Node.js ${{ env.NODE_VERSION }}
36+
uses: actions/setup-node@v2
37+
with:
38+
node-version: ${{ env.NODE_VERSION }}
39+
- name: npm install, build, and test
40+
run: |
41+
# Build and test the project, then
42+
# deploy to Azure Web App.
43+
npm install
44+
npm run build --if-present
45+
npm run test --if-present
46+
- name: 'Deploy to Azure WebApp'
47+
uses: azure/webapps-deploy@v2
48+
with:
49+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
50+
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
51+
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

0 commit comments

Comments
 (0)