Creating of an Azure Static Web App through GitHub with Retype - call from a different branch

Joel Taylor 71 Reputation points
2022-04-04T02:09:26.197+00:00

Hi,

I am trying to create a SWA that links to GitHub, but I am having some issues.

I am building a website with Retype - I assume that the steps that it accomplishes does not fit well with what the SWA is trying to do. Retype "automatically builds your website upon each commit to the main branch, and then deploys your new Retype powered website to a retype branch."

The SWA, however, is trying to build from the main branch. Every time it runs, I get errors which seem to basically say that the app/files location can't be found (see below for errors).

While anything that I say is speculation, I am supposing that the azure-static-web-apps-<RANDOM_NAME>.yml found in workflow can only look in the main branch - which is the default. Since Retype deploys the app to the retype branch, the Azure SWA cannot find the app/files to build the website - and thus the errors. I plan to try and change the branch location to retype in the azure-static-web-apps-<RANDOM_NAME>.yml settings (see below from example). I did try and just change the azure-static-web-apps-<RANDOM_NAME>.yml code to the different branch - to no effect (without modifying settings in the Azure site).

However, I do not expect this to be completely successful because when Retype builds and deploys to the retype branch, the azure-static-web-apps-<RANDOM_NAME>.yml file is not included in the end result. I have attempted to force the inclusion of the azure-static-web-apps-<RANDOM_NAME>.yml through appropriate code, but with no success.

While one considering writing an answer to this question may not know of Retype, I would like any advice and assistance on the SWA and the means and process of successfully creating it. For example, is my speculation correct? Should I direct the azure-static-web-apps-<RANDOM_NAME>.yml to the retype branch through a different means? Also, any advice on
the app_ / api_ / output_location would be helpful, too (at the moment, these are being left as default ("/", "/" and "", respectively).

I am seeking assistance from the developers of Retype to attempt to find a solution from their end, as well.

Anyone that has any ideas or advice on SWA would be most appreciated.

----------

Azure SWA Build and Deploy error:
Azure Static Web Apps utilizes Oryx to build both static applications and Azure Functions. You can find more details on Oryx here: https://github.com/microsoft/Oryx
---Oryx build logs---

Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx  
You can report issues at https://github.com/Microsoft/Oryx/issues  
  
Oryx Version: 0.2.20220323.2, Commit: a7f6e2eb2eb42b5c2283d25131ef1f097480015e, ReleaseTagName: 20220323.2  
  
Build Operation ID: |zQZrj+LLAIo=.e111cf36_  
Repository Commit : 72896c909d6d80eddb2fe31a5b7c4f69b9f26b5f  
  
Detecting platforms...  
Could not detect any platform in the source directory.  
Error: Could not detect the language from repo.  
  
  
---End of Oryx build logs---  
Oryx was unable to determine the build steps. Continuing assuming the assets in this folder are already built. If this is an unexpected behavior please contact support.  
Finished building app with Oryx  
Failed to find a default file in the app artifacts folder (/). Valid default files: index.html,Index.html.  
If your application contains purely static content, please verify that the variable 'app_location' in your workflow file points to the root of your application.  
If your application requires build steps, please validate that a default file exists in the build output directory.  
  
  
For further information, please visit the Azure Static Web Apps documentation at https://learn.microsoft.com/en-us/azure/static-web-apps/  
If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/  
Exiting  

----------

azure-static-web-apps-<RANDOM_NAME>.yml example code for different branch

name: Azure Static Web Apps CI/CD  
  
on:  
  push:  
    branches:  
      - retype  
  
  pull_request:  
    types: [opened, synchronize, reopened, closed]  
    branches:  
      - retype  

----------

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

Accepted answer
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2022-04-19T12:43:03.76+00:00

    @Joel Taylor , Following-up to add more info:

    When you create a Static web app, we generate a GitHub Actions CI/CD workflow on behalf of the branch you selected. It is normally configured to run whenever a commit occurs to the branch it is configured for.

    So in this case, if you want to publish the contents of the retype branch, you would want to either choose the retype branch when creating the SWA or manually edit the workflow to go against that branch.

    --
    To benefit the community find the right answers, please do mark the post which was helpful by clicking on Accept Answer’ & ‘Up-Vote’.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.