Skip to content
Latchkey

Azure Static Web Apps CI/CD workflow (microsoft/Web-Dev-For-Beginners)

The Azure Static Web Apps CI/CD workflow from microsoft/Web-Dev-For-Beginners, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: microsoft/Web-Dev-For-Beginners.github/workflows/azure-static-web-apps-ashy-river-0debb7803.ymlLicense MITView source

What it does

This is the Azure Static Web Apps CI/CD workflow from the microsoft/Web-Dev-For-Beginners repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Azure Static Web Apps CI/CD


on: workflow_dispatch


jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')

    runs-on: ubuntu-latest

    name: Build and Deploy Job

    steps:
      - uses: actions/checkout@v3

        with:
          submodules: true

      - name: Build And Deploy

        id: builddeploy

        uses: Azure/static-web-apps-deploy@v1

        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ASHY_RIVER_0DEBB7803 }}

          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: "/quiz-app" # App source code path

          api_location: "" # Api source code path - optional

          output_location: "dist" # Built app content directory - optional

          ###### End of Repository/Build Configurations ######


  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_ASHY_RIVER_0DEBB7803 }}

          action: "close"

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Azure Static Web Apps CI/CD



on: workflow_dispatch



jobs:

  build_and_deploy_job:

    timeout-minutes: 30

    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')

    runs-on: latchkey-small

    name: Build and Deploy Job

    steps:

      - uses: actions/checkout@v3

        with:

          submodules: true

      - name: Build And Deploy

        id: builddeploy

        uses: Azure/static-web-apps-deploy@v1

        with:

          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ASHY_RIVER_0DEBB7803 }}

          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: "/quiz-app" # App source code path

          api_location: "" # Api source code path - optional

          output_location: "dist" # Built app content directory - optional

          ###### End of Repository/Build Configurations ######



  close_pull_request_job:

    timeout-minutes: 30

    if: github.event_name == 'pull_request' && github.event.action == 'closed'

    runs-on: latchkey-small

    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_ASHY_RIVER_0DEBB7803 }}

          action: "close"

 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow