Skip to content

Azure Static Web Apps

Azure Static Web Apps provides hosting for static sites with a built-in CI/CD pipeline via GitHub Actions or Azure DevOps. pageflare integrates as a post-build step in your workflow.

Azure Static Web Apps uses a GitHub Actions workflow (or Azure DevOps pipeline) to build and deploy your site. Add pageflare between the build step and the Azure deploy action.

  1. Go to your Static Web App in the Azure Portal.
  2. Navigate to Configuration > Application settings.
  3. Add a setting named PAGEFLARE_LICENSE with your license key.
  4. Save.

For the build pipeline, add it as a GitHub Actions secret:

  1. Go to your repository Settings > Secrets and variables > Actions.
  2. Add a secret named PAGEFLARE_LICENSE.

Azure generates a GitHub Actions workflow when you create a Static Web App. Modify it to include pageflare:

.github/workflows/azure-static-web-apps.yml
name: Azure Static Web Apps
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Optimize with pageflare
uses: getappz/pageflare-cli@v1
with:
args: "dist/ --in-place"
env:
PAGEFLARE_LICENSE: ${{ secrets.PAGEFLARE_LICENSE }}
- name: Deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: upload
app_location: dist
skip_app_build: true

Key changes from the default workflow:

  • Build the site yourself (npm run build) instead of letting the Azure action build it.
  • Set skip_app_build: true so the Azure action only uploads, not rebuilds.
  • Add the pageflare step between build and deploy.

Replace dist/ with your framework’s output directory.

- name: Build
run: npm run build
- name: Optimize with pageflare
uses: getappz/pageflare-cli@v1
with:
args: "dist/ --in-place"
- name: Deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: upload
app_location: dist
skip_app_build: true
- name: Build
run: npm run build
- name: Optimize with pageflare
uses: getappz/pageflare-cli@v1
with:
args: "out/ --in-place"
- name: Deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: upload
app_location: out
skip_app_build: true

If you use Azure DevOps instead of GitHub Actions:

azure-pipelines.yml
trigger:
branches:
include:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '22.x'
- script: npm ci && npm run build
displayName: 'Build'
- script: |
curl -fsSL https://get.appz.dev/pageflare/install.sh | sh
~/.pageflare/bin/pageflare dist/ --in-place --no-progress
displayName: 'Optimize with pageflare'
env:
PAGEFLARE_LICENSE: $(PAGEFLARE_LICENSE)
- task: AzureStaticWebApp@0
inputs:
app_location: dist
skip_app_build: true
env:
azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_API_TOKEN)
VariableDescription
PAGEFLARE_LICENSEPro license key. Set in Azure Portal or as a pipeline secret.

Check the GitHub Actions (or Azure DevOps) build logs. Look for the pageflare summary:

Done 145.2 KB saved (38.1%) 1.2s
Files 42 total, 38 optimized, 4 unchanged, 0 errors

Azure action rebuilds the site Set skip_app_build: true in the Azure deploy action. Without this flag, Azure will rebuild the site using its own Oryx build system, ignoring your pageflare-optimized output.

pageflare output overwritten Make sure the pageflare step runs after the build and before the Azure deploy action. The deploy action uploads whatever is in app_location.

Custom domain HTTPS issues Azure Static Web Apps handles SSL automatically for custom domains. pageflare does not affect HTTPS — if you see certificate errors, check your Azure DNS configuration.