Skip to content

Azure Static Web Apps CI/CD for commit d870c152fe101cc14e324153f12146ed6fa04197 #114

Azure Static Web Apps CI/CD for commit d870c152fe101cc14e324153f12146ed6fa04197

Azure Static Web Apps CI/CD for commit d870c152fe101cc14e324153f12146ed6fa04197 #114

name: Azure Static Web Apps CI/CD
run-name: "Azure Static Web Apps CI/CD for commit ${{ github.sha }}"
on:
push:
branches:
- main
paths:
- "webapp/**"
- "api/**"
- ".github/workflows/static_webapp_pipeline.yaml"
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
paths:
- "webapp/**"
- "api/**"
- ".github/workflows/static_webapp_pipeline.yaml"
env:
APP_LOCATION: "webapp"
API_LOCATION: "api"
OUTPUT_LOCATION: "dist/semantic-searcher"
permissions:
issues: write
contents: read
pull-requests: write
jobs:
webapp_ci:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
name: Test Webapp
defaults:
run:
working-directory: ${{ env.APP_LOCATION }}
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: "18"
- name: Test
run: npm install && npm test
api_ci:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
name: Test API
defaults:
run:
working-directory: ${{ env.API_LOCATION }}
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: "18"
- name: Test
run: npm install && npm test
build_and_deploy:
if: github.event_name == 'push'
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- uses: actions/[email protected]
- name: Build And Deploy
uses: Azure/static-web-apps-deploy@v1
env:
NODE_VERSION: "18.14.0"
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: ${{ env.APP_LOCATION }}
api_location: ${{ env.API_LOCATION }}
app_build_command: "npm run build"
api_build_command: "npm run build"
output_location: ${{ env.OUTPUT_LOCATION }}