Skip to content

Merge pull request #11 from toddaheath/fix/prod-helm-timeout #8

Merge pull request #11 from toddaheath/fix/prod-helm-timeout

Merge pull request #11 from toddaheath/fix/prod-helm-timeout #8

Workflow file for this run

name: Deploy to Prod
on:
push:
branches:
- main
concurrency:
group: deploy-prod
cancel-in-progress: false
permissions:
contents: read
packages: write
id-token: write # required for OIDC authentication with Azure
env:
REGISTRY: ghcr.io
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
build-and-push:
name: Build & Push Images
needs: ci
runs-on: ubuntu-latest
environment: prod
outputs:
image-tag: ${{ steps.meta.outputs.tag }}
steps:
- uses: actions/checkout@v4
- name: Set image tag
id: meta
run: echo "tag=prod-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push API image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.api
push: true
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/shed-builder-api:${{ steps.meta.outputs.tag }}
${{ env.REGISTRY }}/${{ github.repository_owner }}/shed-builder-api:latest
- name: Build and push UI image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.ui
push: true
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/shed-builder-ui:${{ steps.meta.outputs.tag }}
${{ env.REGISTRY }}/${{ github.repository_owner }}/shed-builder-ui:latest
deploy:
name: Deploy to Production
needs: build-and-push
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- name: Setup Helm
uses: azure/setup-helm@v4
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Get AKS credentials
uses: azure/aks-set-context@v3
with:
resource-group: ${{ vars.RESOURCE_GROUP }}
cluster-name: ${{ vars.AKS_CLUSTER_NAME }}
- name: Deploy with Helm
run: |
helm upgrade --install shed-builder deploy/helm/shed-builder \
--namespace production --create-namespace \
-f deploy/helm/shed-builder/values-prod.yaml \
--set api.image.repository=${{ env.REGISTRY }}/${{ github.repository_owner }}/shed-builder-api \
--set api.image.tag=${{ needs.build-and-push.outputs.image-tag }} \
--set ui.image.repository=${{ env.REGISTRY }}/${{ github.repository_owner }}/shed-builder-ui \
--set ui.image.tag=${{ needs.build-and-push.outputs.image-tag }} \
--set postgres.password=${{ secrets.DB_PASSWORD }} \
--wait --timeout 10m