Azure static web apps

I’m investigating cleavr as an option and I’d like to know if anyone is using it with Azure and especially static web apps. If so would that still need to go through github workflows to keep the PR preview URLs? Would cleavr be able to add rollbacks on top of static web apps, etc?

Thanks for any input on this, cleavr looks interesting. I found the service via the quasar docs by the way.

Hey @shawn, welcome to the Cleavr forum!

I’m not certain if anyone is using Cleavr with Azure. Since we don’t have an integration with Azure, you’d need to connect to Azure (with Ubuntu 20.04 loaded on it) via the custom server method, which obfuscates the provider.

Maybe someone who has used Cleavr with Azure + Static sites will see this and can jump in. :slight_smile:

As long as the app / static site is being deployed via Cleavr, Cleavr has rollback options for the last few successful deployments.

1 Like

Thanks for the super fast response. I was thinking it looked like Azure we be under the custom and its cool that we could get rollbacks that way.

Static web apps is a bit different. I’m guessing cleavr can do the build portion or even let github do it. The github workflow that azure generates for the deploy uses this: GitHub - Azure/static-web-apps-deploy: Enable GitHub developers to deploy to Azure Static Web Apps using GitHub Actions

And looks something like this in the workflow:

name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
      - main
  pull_request:
    types: [opened, synchronize, reopened, closed]
    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/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_SOMETHING_GENERATED }}
          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 your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "/api" # Api source code path - optional
          output_location: "/dist" # 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/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_SOMETHING_GENERATED }}
          action: "close"

so it deploys and opens a preview URL for pull requests into the main branch and destroys the preview URLs when its closed. The github workflow won’t build when there is a conflict, this would be cool to get around if possible. I wonder if cleavr could separate the build & deploy more?

We do have an integration with GitHub Actions, that you can enable in web app > settings Github Action, assuming the VC profile is a GitHub profile.

This will add a workflow file to the project in GH that can be modified. I’d suggest playing around with that to see if it helps. (sounds like a good blog if it does :slight_smile: )

I notice its required to setup a server before a webapp. The choices I see don’t match for a static web app deploy. If I am checking out the GitHub action option, does the server choice matter? (I also just realized I only have a 5 day window for messing around)

Hey Shawn,

The web apps do require at least one server and a site to tie to in order to create.

The server type doesn’t matter (mostly - it cannot be a load balance server type). GitHub Actions requires the VC profile to be a GitHub profile and also the repository must be owned by the vc profile. After selecting a GitHub repo and saving, then a new tab in the settings section will open up for enabling GitHub Actions.

Send me a PM with the email you use for your account and I’ll extend your trial time. :slight_smile:

No way to get around an IP address since I don’t have one?

You would need a server to be tied to it.

I’m curious, are you trying to set something up with your localhost?

Looking to tie to Azure static web apps, was thinking there might be a way to separate their build & deploy actions into 2 workflows that cleavr would manage for builds/deploys & rollbacks. Currently Azure does not offer rollbacks as a feature and the single github workflow won’t build when there is a merge conflict. Looking for options to make that set up nicer.

It’d involve figuring out what bash scripts to write, but you can add additional deployment hooks (and disable ones not required) and write scripts to manage actions.

I need to handle the custom server addition to get that far. Azure static web apps are similar to Netlify. If I want to add only static web apps, I don’t have a server IP to provide. :thinking: