Skip to content

Refactor deployment workflow to streamline build process and update a… #6

Refactor deployment workflow to streamline build process and update a…

Refactor deployment workflow to streamline build process and update a… #6

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy Node.js app to Azure Web App - subtracker
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install dependencies
run: npm install
- name: Build the app
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: node-app
path: dist/
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@v4
with:
name: node-app
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'subtracker'
package: dist/
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_31F85007BEBA4D3482D09536C58FE53C }}