azurecachingdeploymentgithub-actionsazure-static-web-app

GitHub Actions Build Successful, But Website Doesn't Reflect Code Changes (Deployment Issue)


I'm working on a project hosted on GitHub and using a build pipeline with GitHub Actions. While the build pipeline executes successfully, the changes I make to my index.html file aren't reflected on my live website. Here's a breakdown of what I'm experiencing:

I'd like to understand why the changes to index.html aren't reflected on my live website and how to ensure the build pipeline successfully deploys the updated code. Any guidance or suggestions would be greatly appreciated!

I've already tried clearing my browser cache and redeploying the website, but the changes still aren't reflected. Environment:

Deployment Setup: I'm using Azure CDN and my custom domain for website deployment. Build Pipeline: I'm using the following actions in my workflow YAML file: actions/checkout@v4 (as suggested by the warning) azure/login@v2 (as suggested by the warning) Workflow Configuration: I copied the workflow configuration from the official Microsoft documentation: Link

My frontend.yml file:

name: deploy_frontend

Deploys when push is made from the frontend folder

on: push: branches: [ main ] paths: - 'frontend/**'

jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Upload to blob storage
  uses: azure/CLI@v1
  with:
    inlineScript: |
        az storage blob upload-batch --account-name azureresumefaizan --auth-mode key -d '$web' -s frontend/
- name: Purge CDN endpoint
  uses: azure/CLI@v1
  with:
    inlineScript: |
       az cdn endpoint purge --content-paths  "/*" --profile-name "azureresumefaizanshaikh" --name "azureresumefaizanshaikh" --resource-group "faizresume-rg"

Azure logout

- name: logout
  run: |
        az logout
  if: always()

Solution

  • Website Doesn't Reflect Code Changes

    Because you are not overwriting the changes to blob container. you need to use --overwrite true in the command to update changes.

    this worked for me

    name: deploy_frontend
    # Deploys when push is made from the frontend folder
    
    on:
        push:
            branches: 
                - main
        workflow_dispatch:
    
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
        
        - name: checkout
          uses: actions/checkout@v4
    
        - name: azure login
          uses: azure/login@v1
          with:
              creds: ${{ secrets.AZURE_CREDENTIALS }}
    
        - name: Upload to blob storage
          uses: azure/CLI@v1
          with:
            inlineScript: |
                az storage blob upload-batch --account-name blobstaticapp --account-key ${{vars.KEY}} -d '$web' -s frontend/ --overwrite true
        
        - name: Purge CDN endpoint
          uses: azure/CLI@v1
          with:
            inlineScript: |
               az cdn endpoint purge --content-paths  "/*" --profile-name "blobcdn" --name "blobstaticcdn" --resource-group "<resourcegroupname>"
      # Azure logout
        - name: logout
          run: |
                az logout
          if: always()
    

    OUTPUT:

    I used your git repo and cloned.

    Azure CDN

    Before :

    GitHub Build and Deployment :

    After :

    Original static website url :