Skip to content

Build and deploy restaurant web #2

Build and deploy restaurant web

Build and deploy restaurant web #2

name: Build and deploy restaurant web
run-name: Build and deploy restaurant web
on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'restaurant/web/**'
env:
WEB_APP_LOCATION: restaurant/web
WEB_APP_ARTIFACT_LOCATION: dist # relative to WEB_APP_LOCATION
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
- name: Install dependencies
shell: bash
working-directory: ${{ env.WEB_APP_LOCATION }}
run: |
npm ci
- name: Build project
shell: bash
working-directory: ${{ env.WEB_APP_LOCATION }}
run: |
npm run build
deploy-dev:
needs: [build]
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.azure_credentials }}
- name: Build and Deploy web app
uses: Azure/static-web-apps-deploy@v1
env:
VITE_AUTH_CLIENT_ID: ${{ vars.VITE_AUTH_CLIENT_ID_RESTAURANT }}
VITE_API_BASE_URL: ${{ vars.VITE_API_BASE_URL_RESTAURANT }}
VITE_API_SCOPE: ${{ vars.VITE_API_SCOPE_RESTAURANT }}
with:
azure_static_web_apps_api_token: ${{ secrets.WEBAPP_DEPLOYMENT_TOKEN_RESTAURANT }}
repo_token: ${{ secrets.github_token }}
action: "upload"
app_location: ${{ env.WEB_APP_LOCATION }}
app_artifact_location: ${{ env.WEB_APP_ARTIFACT_LOCATION }}