Skip to content

Deploy to Production #91

Deploy to Production

Deploy to Production #91

name: Deploy to Production
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build_date:
runs-on: ubuntu-latest
name: Generate BUILD_DATE
steps:
- name: Get current date
id: date
run: echo "BUILD_DATE=$(date +'+%A %W %Y %X')" >> $GITHUB_OUTPUT
outputs:
BUILD_DATE: ${{ steps.date.outputs.BUILD_DATE }}
build_and_push_image:
name: Build and Push Image
uses: zooniverse/ci-cd/.github/workflows/build_and_push_image.yaml@main
needs: build_date
with:
repo_name: subject-set-search-api
commit_id: ${{ github.sha }}
latest: true
build_args: |
BUILD_DATE=${{ needs.build_date.outputs.BUILD_DATE }}
deploy_production:
name: Deploy to Production
uses: zooniverse/ci-cd/.github/workflows/deploy_app.yaml@main
needs: build_and_push_image
with:
app_name: subject-set-search-api
commit_id: ${{ github.sha }}
environment: production
deploy_check: false
secrets:
creds: ${{ secrets.AZURE_AKS }}
restart_pod:
runs-on: ubuntu-latest
needs: deploy_production
steps:
- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_AKS }}
- name: Set the target AKS cluster
uses: Azure/aks-set-context@v4
with:
cluster-name: microservices
resource-group: kubernetes
- name: Restart the pod
run: kubectl rollout restart deployment subject-set-search-api-production-app