'Azure SWA How to Specify a PRODUCTION Build in GitHub Workflow .yml File?

Have a Static Web App (SWA) with integrated API, Azure has auto-gen a .github/workflows/azure-static-web-apps-xxx.yml file for master branch.

As I'm reading Angular's Building and serving that each environment should have its specific build like ng build --configuration production so this will take place

"configurations": {
  "production": {
    "fileReplacements": [
      {
        "replace": "src/environments/environment.ts",
        "with": "src/environments/environment.prod.ts"
      }
    ],

Although .yml has no build command, I found GitHub, Action tab, Build and Deploy Job log shows

...
56  Running 'npm install --unsafe-perm'...
...
86  > [email protected] build /github/workspace
87  > ng build
...

Without --configuration production line 87 will build a "development" by default and push to Azure.

Is there any way I can add a such configuration in .yml file?



Solution 1:[1]

.yml builds PRODUCTION.

It's easy to check if your API have any reference to process.env as DEV stores them in local.settings.json but Azure Portal for PRODUCTION, or front-end's environment.ts vs. environment.production.ts in src\environments folder

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeb50