Deploy to AKS production cluster #915
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to AKS production cluster | |
on: | |
push: | |
branches: | |
- main | |
schedule: # 06:00 UTC Mon-Fri | |
- cron: '0 6 * * 1-5' | |
workflow_dispatch: | |
env: | |
DOCKER_IMAGE: ghcr.io/dfe-digital/teacher-services-tech-docs | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- run: bundle exec middleman build | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
tags: | | |
${{env.DOCKER_IMAGE}}:${{ github.sha }} | |
${{env.DOCKER_IMAGE}}:latest | |
push: true | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Set up kubelogin for non-interactive login | |
uses: azure/use-kubelogin@v1 | |
with: | |
kubelogin-version: 'v0.0.34' | |
- uses: azure/aks-set-context@v3 | |
with: | |
resource-group: s189p01-tsc-pd-rg | |
cluster-name: s189p01-tsc-production-aks | |
use-kubelogin: true | |
admin: 'false' | |
- name: Deploy to AKS | |
uses: Azure/k8s-deploy@v4 | |
with: | |
namespace: bat-production | |
manifests: | | |
manifests | |
images: ${{env.DOCKER_IMAGE}}:${{ github.sha }} | |
annotate-namespace: false | |
pull-images: false |