π Safebank Infrastructure Deployment Workflow π
π Overview
Our deployment workflow uses GitHub Actions to automate releasing Azure infrastructure across three environments: DEV, UAT, and PROD. The workflow ensures consistency and reliability by using Bicep templates and secure secrets management. π οΈ
π Workflow Triggers
The workflow runs in the following cases:
- π Manual Trigger: Developers can manually start the workflow using the
workflow_dispatch
event.
- π Pull Requests: Automatically triggers for pull requests to the
main
branch.
- β¬οΈ Push to Main: Runs for changes pushed directly to the
main
branch (ignores changes in the scripts/
folder).
βοΈ Steps for Each Environment
1οΈβ£ Build Phase
- ποΈ Lint: Checks the Bicep file for syntax issues.
- π¦ Upload: Stores the validated Bicep file as an artifact for use in later steps.
2οΈβ£ Deploy Phase
- DEV: Deploys when changes are pushed to
main
or the workflow is manually triggered.
- UAT: Deploys for pull requests targeting
main
or manual triggers.
- PROD: Deploys under the same conditions as UAT to ensure consistency.
π§ Steps in Deployment:
- π₯ Download: Retrieves the validated Bicep file.
- π Authenticate: Logs into Azure using secure credentials.
- π Deploy: Deploys the Bicep file to the appropriate environment using parameters like:
- Admin credentials
- Slack webhook URL for notifications
π Key Points
- Environment Variables: The workflow uses specific resource groups and subscriptions for each environment to ensure isolation. π’
- π Security: Secrets (e.g., SQL admin credentials, Slack webhook) are stored securely in GitHub Secrets.
- π€ Automation: No manual intervention is required once the workflow starts.
- ποΈ Flexibility: Manual triggers allow developers to deploy changes on demand.
π‘ Benefits
- β
Consistency: Automated linting and artifact storage ensure that the same validated template is deployed.
- β‘ Speed: Changes are deployed to the correct environment as soon as theyβre approved.
- π Transparency: Clear triggers and conditions prevent accidental deployments.