Skip to content

chore(deps): update all #944

chore(deps): update all

chore(deps): update all #944

name: Azure Static Web Apps CI/CD
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
workflow_dispatch:
permissions:
id-token: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_deploy:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: πŸš€ Build and Deploy
outputs:
swa_url: ${{ steps.swa.outputs.static_web_app_url }}
steps:
- name: πŸ›ŽοΈ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: ⏳ Install Dependencies
run: npm ci
- name: πŸ§ͺ Unit Test
run: npm run test:unit
# - name: 🎭 Install Playwright
# run: npx playwright install --with-deps
# - name: πŸ§‘β€πŸ€β€πŸ§‘ Fetching Contributors
# run: npm run contributors
- name: πŸš€ Build And Deploy
id: swa
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_SALMON_ROCK_0FB035B03 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: 'upload'
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: '/' # App source code path
api_location: '' # Api source code path - optional
output_location: 'build' # Built app content directory - optional
production_branch: 'main'
###### End of Repository/Build Configurations ######
env:
VITE_PUBLIC_HASH: ${{ github.sha }}
VITE_PUBLIC_GA_TRACKING_ID: ${{ secrets.GTAG }}
VITE_PUBLIC_BASE_PATH: ${{ vars.PUBLIC_BASE_PATH }}
smoke_test_job:
name: ☁️ Smoke test
needs: build_and_deploy
runs-on: ubuntu-latest
steps:
- name: πŸ›ŽοΈ Checkout
uses: actions/checkout@v3
- name: OIDC Login to Azure Public Cloud
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true
- name: πŸ› οΈ Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
- name: πŸ”Ž Install dependencies
run: npm install
# Not needed because of Playwright Service
# - name: 🎭 Install Playwright
# run: npx playwright install --with-deps
- name: πŸ§ͺ Run Playwright Tests on ${{ needs.build_and_deploy.outputs.swa_url }}
run: npx playwright test --config=playwright.service.config.ts
env:
PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}
PLAYWRIGHT_SERVICE_RUN_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}
PLAYWRIGHT_TEST_BASE_URL: ${{ needs.build_and_deploy.outputs.swa_url }}
- name: πŸ“¦ Upload Test Results Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-test-results
path: playwright-report
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: πŸ“• Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_SALMON_ROCK_0FB035B03 }}
action: 'close'