0

I have this Github Action for Azure Static Web App for Blazor WASM app and I would like to build my project using Configuration "PROD". How can I get oryx to build the project in PROD instead of Release?

Thanks!

name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
      - main

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@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/[email protected]
        with:
          azure_static_web_apps_api_token: ${{ secrets.TOKEN }}
          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 you app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "myproject" # App source code path
          #api_location: "Api" # Api source code path - optional
          output_location: "wwwroot" # 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/[email protected]
        with:
          azure_static_web_apps_api_token: ${{ secrets.TOKEN }}
          action: "close"
1
  • Could you update your question to make it more clear (and helpful for others who may come across this) what specifically you are referring to in Azure Static Web Apps with 'Configuration "PROD"'? Is it the Static Web Apps API application settings environment? learn.microsoft.com/en-us/azure/static-web-apps/… Commented Feb 19, 2022 at 20:45

2 Answers 2

0

Solved!

Just add env variable to your action:

env:
  MSBUILD_CONFIGURATION: PROD
Sign up to request clarification or add additional context in comments.

Comments

0

You can do custom build to match your needs and simply deploy using Azure/static-web-apps-deploy@v1 as shown below.

- name: Publish Blazor Project
  run: dotnet publish ./Web/Web.csproj -c:Release --no-restore -o dist/Web --nologo

- uses: Azure/static-web-apps-deploy@v1
  with:
    azure_static_web_apps_api_token: ${{ env.AZURE_STATIC_WEB_APPS_API_TOKEN }}
    action: "upload"
    skip_app_build: true
    app_location: "dist/Web/wwwroot"
    api_location: ""
    output_location: ""

If you see above, I have set skip_app_build: true and did mu custom build in previous steps in my job and simply set the published file path in app_location.

I have a detailed write up here - https://ilovedotnet.org/blogs/blazor-wasm-publishing-to-azure-static-web-apps/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.