Cannot deploy Blazor WASM to Azure Static Web *Production* always deploys to Preview Slot

43 views Asked by At

I am trying to publish a Blazor WASM to production in an azure static web app (visual studio, github ci/cd) but all my publishes end up in the preview environment. How do I get my publish to hit the production slot vs the preview slot?

I have tried manually editing the yml file (just creates a new preview slot called production) and forcing a merge in Github (read it would trigger a production deploy but still went to preview) but it always publishes to a preview slot and never hits the production slot.

SWA Environments

Here is my yml file:

name: Build and deploy .NET Core application to Web App HspBlazorWasmClient
on:
  pull_request:
    types:
    - opened
    - synchronize
    - reopened
    - closed
    branches:
    - master
  push:
    branches:
    - master
env:
  AZURE_STATIC_WEBAPP_NAME: HspBlazorWasmClient
  APP_DIRECTORY: HspBlazorWasm.Client
  #API_DIRECTORY: HspBlazorWasm
  OUTPUT: wwwroot
  DEPLOYMENT_ENVIRONMENT: Production
jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    name: Build and Deploy Job
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        submodules: true
    - id: builddeploy
      name: Build And Deploy
      uses: Azure/static-web-apps-deploy@v1
      with:
        azure_static_web_apps_api_token: ${{ secrets.HspBlazorWasmClient_SPN }}
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        action: upload
        deployment_environment: ${{env.DEPLOYMENT_ENVIRONMENT}}
        app_location: ${{ env.APP_DIRECTORY }}
        #api_location: ${{ env.API_DIRECTORY }}
        output_location: ${{ env.OUTPUT }}
  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    name: Close Pull Request Job
    runs-on: ubuntu-latest
    steps:
    - id: closepullrequest
      name: Close Pull Request
      uses: Azure/static-web-apps-deploy@v1
      with:
        azure_static_web_apps_api_token: ${{ secrets.HspBlazorWasmClient_SPN }}
        action: close
        repo_token: ${{ secrets.GITHUB_TOKEN }}

1

There are 1 answers

0
LHill On

SOLVED: I commented out the DEPLOYMENT_ENVIRONMENT variable and this forced it to publish to the Production environment.