CDN Code Deploy
The CDN Code Deploy action is a utility that simplifies the deployment of assets to a Content Delivery Network (CDN). It also provides the ability to selectively purge specific paths or perform a full purge of the CDN cache.
How It Works
The action performs the following steps:
- Synchronizes the specified directory with the Azure Blob Storage container.
- Optionally purges specific paths in the CDN cache if
selective_purge_paths
is provided. - If no specific paths are provided, purges the entire CDN cache.
Usage
To use the CDN Code Deploy action, create a workflow file in your repository. Below is an example configuration:
name: CDN Code Deploy
on:
workflow_dispatch:
jobs:
cdn_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# ...other steps, such as Azure login, can be added here...
- name: Deploy to CDN
uses: pagopa/dx/.github/actions/cdn-code-deploy@main
with:
storage_account_name: "your-storage-account-name"
blob_container_name: "your-blob-container-name"
resource_group_name: "your-resource-group-name"
profile_name: "your-cdn-profile-name"
endpoint_name: "your-cdn-endpoint-name"
selective_purge_paths: "./path/file1 ./path/file2"
sync_dir_name: "dist"
working_directory: "."
When implementing this action in your repository:
- Adjust paths - Ensure
sync_dir_name
andworking_directory
match your project structure. - Selective purge - Use
selective_purge_paths
to optimize cache purging for specific files or directories. - Permissions - Ensure the Azure CLI is authenticated and has the necessary permissions to access the storage account and CDN.