Skip to content

Commit 4dc9da8

Browse files
authored
Create azure-webapps-node.yml
1 parent 2dfa34d commit 4dc9da8

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This workflow will build and push a node.js application to an Azure Web App when a commit is pushed to your default 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/en-us/azure/app-service/quickstart-nodejs?tabs=linux&pivots=development-environment-cli
5+
#
6+
# To configure this workflow:
7+
#
8+
# 1. Download the Publish Profile for your Azure Web App. You can download this file from the Overview page of your Web App in the Azure Portal.
9+
# For more information: https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials
10+
#
11+
# 2. Create a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE, paste the publish profile contents as the value of the secret.
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 value for the AZURE_WEBAPP_NAME. Optionally, change the AZURE_WEBAPP_PACKAGE_PATH and NODE_VERSION environment variables below.
15+
#
16+
# For more information on GitHub Actions for Azure: https://github.com/Azure/Actions
17+
# For more information on the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
18+
# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples
19+
20+
on:
21+
push:
22+
branches: [ "arduino" ]
23+
workflow_dispatch:
24+
25+
env:
26+
AZURE_WEBAPP_NAME: rythm-music-bot # set this to your application's name
27+
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
28+
NODE_VERSION: '16.x' # set this to the node version to use
29+
30+
permissions:
31+
contents: read
32+
33+
jobs:
34+
build:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v3
38+
39+
- name: Set up Node.js
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: ${{ env.NODE_VERSION }}
43+
cache: 'npm'
44+
45+
- name: npm install, build, and test
46+
run: |
47+
npm install
48+
npm run build --if-present
49+
npm run test --if-present
50+
51+
- name: Upload artifact for deployment job
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: node-app
55+
path: .
56+
57+
deploy:
58+
permissions:
59+
contents: none
60+
runs-on: ubuntu-latest
61+
needs: build
62+
environment:
63+
name: 'Development'
64+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
65+
66+
steps:
67+
- name: Download artifact from build job
68+
uses: actions/download-artifact@v3
69+
with:
70+
name: node-app
71+
72+
- name: 'Deploy to Azure WebApp'
73+
id: deploy-to-webapp
74+
uses: azure/webapps-deploy@v2
75+
with:
76+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
77+
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
78+
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

0 commit comments

Comments
 (0)