Deploy to AKS production cluster #952
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: | |
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: Build and push docker image | |
id: build-image | |
uses: DFE-Digital/github-actions/build-docker-image@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
context: . | |
max-cache: true | |
reuse-cache: true | |
snyk-token: ${{ secrets.SNYK_TOKEN }} | |
- uses: azure/login@v1 | |
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule' | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Set up kubelogin for non-interactive login | |
uses: azure/use-kubelogin@v1 | |
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule' | |
with: | |
kubelogin-version: 'v0.0.34' | |
- uses: azure/aks-set-context@v3 | |
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule' | |
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 | |
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule' | |
with: | |
namespace: bat-production | |
manifests: | | |
manifests | |
images: ${{env.DOCKER_IMAGE}}:${{ github.sha }} | |
annotate-namespace: false | |
pull-images: false |