Skip to content

Build and deploy to azure #81

Build and deploy to azure

Build and deploy to azure #81

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: "22.20.0"
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: Copy built shared package to backend node_modules
run: |
mkdir -p ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/node_modules/@webmud3
cp -r shared/dist ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/node_modules/@webmud3/shared
cp shared/package.json ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/node_modules/@webmud3/shared/
- 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