-
Notifications
You must be signed in to change notification settings - Fork 16
GitHub Action Build and Deploy
This GitHub Action builds and deploys the SSW.Rules application as a Docker container to Azure Web App.
flowchart TD
A[Trigger] --> B{Trigger Type}
B -->|Push to main| C
B -->|Manual dispatch| C
C[Start pipeline] --> D[Deploy Infrastructure]
D --> E[Build and Push Container Image]
E --> F[Deploy to Azure Web App]
F --> G{Production?}
G -->|Yes| H[Deploy to Slot]
H --> I[Swap Slots]
I --> J[Verify Deployment]
G -->|No| J[Verify Deployment]
J --> K{Production?}
K -->|Yes| L[Crawl Sitemap]
K -->|No| M[Done]
L --> M[Done]
style A fill:#f9f,stroke:#333,stroke-width:1px
style B fill:#ccf,stroke:#333,stroke-width:1px
style D fill:#bbf,stroke:#333,stroke-width:1px
style E fill:#bbf,stroke:#333,stroke-width:1px
style F fill:#bfb,stroke:#333,stroke-width:1px
style J fill:#cfc,stroke:#333,stroke-width:1px
style L fill:#ffd,stroke:#333,stroke-width:1px
style M fill:#cfc,stroke:#333,stroke-width:1px
This workflow runs in two ways:
-
On push to
main- Automatically deploys to the default environment (staging).
-
Manually via the Run workflow button
- You can choose the target environment (staging or production).
- You can optionally set the Tina content branch and a source branch name.
The pipeline has three main stages:
- Deploy Infrastructure
- Build and Push Container Image
- Deploy to Azure Web App
This stage ensures Azure resources exist and are up to date.
It:
- Logs into Azure
- Deploys or updates required infrastructure
- Outputs values needed by later stages (ACR name, app service name, resource group, host name)
This stage builds the application as a Docker image and pushes it to Azure Container Registry (ACR).
It:
- Checks out the source repository
- Pulls content from the content repository
- Generates required mapping files
- Builds the application inside Docker
- Pushes the container image to ACR
Notes:
- Docker cache is disabled, so the image is built from scratch each time (fresh build).
- The image is tagged based on the target environment.
This stage deploys the built container image to Azure Web App.
It:
- Logs into Azure
- Sets application settings (Auth0, API keys, build metadata, etc.)
- Deploys the container image to the web app
- Deploys directly to the staging web app
- No slot swap is used
Production uses a safe slot-based rollout:
- Deploy the container to a pre-production slot
- Verify the deployment
- Swap the slot into production
This helps provide:
- Minimal / no downtime
- Safer releases
- Easier rollback (swap back if needed)
If deploying to production, the workflow runs a sitemap crawl after deployment to keep the site index up to date.
This step does not run for staging.
Deployments are grouped by branch + environment.
If a new run starts for the same branch and environment:
- The in-progress run is cancelled
- Only the latest run continues
This prevents overlapping deployments.
During deployment, the app is updated with build information such as:
- Build timestamp
- Build date
- Commit hash
- Version number
- Deployment URL
This improves traceability and makes it easier to confirm what version is running.