Build and deploy spa web #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy spa web | |
run-name: Build and deploy spa web | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: | |
- 'spa/web/**' | |
env: | |
WEB_APP_LOCATION: spa/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_SPA }} | |
VITE_API_BASE_URL: ${{ vars.VITE_API_BASE_URL_SPA }} | |
VITE_API_SCOPE: ${{ vars.VITE_API_SCOPE_SPA }} | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.WEBAPP_DEPLOYMENT_TOKEN_SPA }} | |
repo_token: ${{ secrets.github_token }} | |
action: "upload" | |
app_location: ${{ env.WEB_APP_LOCATION }} | |
app_artifact_location: ${{ env.WEB_APP_ARTIFACT_LOCATION }} |