Skip to content

Build and deploy to azure #2

Build and deploy to azure

Build and deploy to azure #2

name: Build and deploy to azure
on:
push:
branches:
- master
workflow_dispatch:
env:
AZURE_WEBAPP_NAME: unitopia-client
AZURE_WEBAPP_PACKAGE_PATH: "backend/dist"
NODE_VERSION: "20.12.2"
jobs:
deploy:
environment:
name: "azure"
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install all dependencies and build everything
run: |
npm ci
npm run build:prod --if-present
- name: Install raw dependencies for backend
run: |
cd ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
npm install --omit=dev
- name: "Deploy to Azure Web App"
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
slot-name: "production"
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
restart: true