question

JasonFrank-1504 avatar image
0 Votes"
JasonFrank-1504 asked RoarGrnmo-3974 commented

How to deploy multiple branches to an Azure static web app using GitHub workflow actions?

Once we connect our Azure static web app to the code on GitHub, staging environments are automatically created when a pull request is issued for the main branch (aka master). That part is working fine.

However, I'd like to create staging environments when a pull request is issued for a different branch. Here's the basic idea of a branching scheme to be used for that workflow:

  • main: production

  • dev: staging / integration environment

  • feature-[XYZ]: new features

So, for example, I want to create a staging environment in my Azure static web app when a pull request is issued for the dev branch.

I have not found an example of how to accomplish this. One thing I tried was to add the dev branch in the list of branches in the workflow action file like this:

on:
  push:
    branches:
      - main # 
      - dev  # <-- I added this one
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - main # 
      - dev  # <-- I added this one

jobs:
  build_and_deploy_job:
    # (other normal stuff here - removed for brevity)


While that change did create a deployment to my Azure static web app for the dev branch, it also made my main branch deployment use the dev branch's code.

Screenshot showing the result on Azure environments

The Azure overview page also confirms that it now uses the dev branch for production:

113511-2021-07-07-09-34-32.png

What is the proper way to accomplish my goal?


azure-static-web-apps
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JasonFrank-1504, Apologies for the delay in responding from over the weekend. I'm checking on this and will get back to you shortly.

It looks like you have already checked the steps outlined in these docs:
GitHub Actions workflows for Azure Static Web Apps
Review pull requests in pre-production environments in Azure Static Web Apps

Thanks for your patience.


0 Votes 0 ·

@ajkuma-MSFT Do you know if there is a github issue to follow for the feature you mentioned? Is the feature still expected soon? Thanks!!

0 Votes 0 ·
ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered

@JasonFrank-1504, I received an update from our product team.

Our product engineering team is working on a feature to push from other branches to a single SWA, however there is no concrete ETA on the release yet.

Your feedback on this is very much appreciated. Kindly be assured that I have cascaded your feedback with our product team.

Apologies for any inconvenience with this. Thanks for your patience.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AdamDiment-7565 avatar image
0 Votes"
AdamDiment-7565 answered RoarGrnmo-3974 commented

I have the same requirement. I am upgrading one of my applications from a .net core cshtml web app to a blazor app. Currently for the .net core app I have 3 separate app services on azure (dev, staging, prod) versions. I use azure dev ops to push to each when a pr is merged from the three corresponding branches.

To achieve the same thing with my blazor app, it looks like right now I would have to register 3 separate SWAs each registered to the corresponding dev/stage/prod branch? This basically makes the staging branch PR feature redundant for me though as things stand.

Any news on when this feature will be available @ajkuma-MSFT ?

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AdamDiment-7565, Apologies for the delay in responding.

Thanks for sharing your requirement info. It's expected to be released in a couple of months, however there is no concrete ETA on this yet. I'll post back as soon as I hear back on this.

-Kindly note that the ETA is subject to change depending on the myriad factors.

0 Votes 0 ·

Since it has gone a year, did you fix this issue, or is it postponed ?

0 Votes 0 ·