Azure Static Web Apps CI/CD for commit d3489d89be5d62e7c7543e5a0ee7badc826b0ef2 #113
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: 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 }} |