Skip to content

Deploy Prebuilt Containers #35

Deploy Prebuilt Containers

Deploy Prebuilt Containers #35

Workflow file for this run

name: Deploy Prebuilt Containers
on:
workflow_run:
workflows:
- Build and Push Docker Images
branches:
- main
types:
- completed
workflow_dispatch:
inputs:
image-tag:
description: "Image tag to deploy (e.g. latest, main, pr-123)"
type: string
required: false
default: latest
concurrency:
group: deploy-production
cancel-in-progress: false
jobs:
verify-images:
name: Verify ${{ matrix.label }}
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- label: client image
image: ghcr.io/ls1intum/learn-hub/client
- label: server image
image: ghcr.io/ls1intum/learn-hub/server
permissions:
packages: read
env:
DEPLOY_IMAGE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.image-tag || 'latest' }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check required image exists
run: |
set -euo pipefail
image_ref="${{ matrix.image }}:${DEPLOY_IMAGE_TAG}"
echo "Checking ${image_ref}"
docker buildx imagetools inspect "${image_ref}" > /dev/null
deploy:
needs: verify-images
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: read
packages: read
uses: ls1intum/.github/.github/workflows/deploy-docker-compose.yml@main
with:
environment: production
docker-compose-file: ./docker/compose.prod.yml
main-image-name: ls1intum/learn-hub/server
image-tag: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.image-tag || 'latest' }}
deployment-base-path: ${{ vars.DEPLOYMENT_BASE_PATH }}
secrets: inherit