Skip to content

Add files via upload #20

Add files via upload

Add files via upload #20

name: Build and deploy Node.js app to Azure Web App - UpworthChatbot
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm run test --if-present
- name: Archive build files
run: |
Compress-Archive -Path . -DestinationPath my-app.zip
shell: pwsh
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: my-app.zip
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app
path: .
- name: Extract ZIP file
run: unzip my-app.zip -d my-app
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: 'UpworthChatbot'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_E3ECB830127E454BBC38F200185FAFCD }}
package: my-app